<template>
	<view class="setting1">
		<view class="nav_top left">
			<view class="left">
				<text v-if="lang==0">
					软件版本：
				</text>
				<text v-if="lang==1">
					Version：
				</text>{{data.software_vision}}
			</view>
			<view class="right">
				<text v-if="lang==0">
					硬件版本：
				</text>
				<text v-if="lang==1">
					Hardware：
				</text>
				{{data.m_hardware_vision}}
			</view>
		</view>
		<block v-for="(item,index) in nav_list">
			<view class="nav_menus left" @click="cli_clones(index)">
				<view class="titie_top">
					<view class="top_left left">

						<image class="le_img" :src="item.img"></image>
						<view v-if="lang==0">
							{{item.title}}
						</view>
						<view v-if="lang==1">
							{{item.en_title}}
						</view>
					</view>

					<view class="top_right right">
						<image v-if="clone_index==index" src="/static/shang.png"></image>
						<image v-else src="/static/xia.png"></image>

					</view>
				</view>
			</view>

			<block v-if="index==0&&clone_index==0">
				<view class="nav_menus left childers">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										电机类型
									</text>
									<text v-if="lang==1">
										Motor type
									</text>
								</view>
								<view class="right" @click="function_selection_openPicker(0)">
									<input disabled v-model="function_selection[0][dianji_type]" type="text">
									<image class="rig_img" src="../../../static/right2.png"></image>
								</view>
							</view>
						</view>
						<view class="titie_body_line">
						</view>

						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										传感器类型
									</text>
									<text v-if="lang==1">
										sensor type
									</text>
								</view>
								<view class="right" @click="function_selection_openPicker(1)">
									<input disabled v-model="function_selection1[0][chuanganqi_type]" type="text">
									<image class="rig_img" src="../../../static/right2.png"></image>
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>

						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										相移角(°)
									</text>
									<text v-if="lang==1">
										Phase shift angle (°)
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="xiangyijiao" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line">
						</view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										电机内阻Rs(ohm)
									</text>
									<text v-if="lang==1">
										ohm
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="dianjineizu" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										D轴电感Ld(uH)
									</text>
									<text v-if="lang==1">
										Ld(uH)
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="ld" type="text">
								</view>
							</view>
						</view>
						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										Q轴电感Lq(uH)
									</text>
									<text v-if="lang==1">
										Lq(uH)
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="lq" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										反电势Ke(Vrms/Krpm)
									</text>
									<text v-if="lang==1">
										Ke(Vrms/Krpm)
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="ke" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										极对数(P)
									</text>
									<text v-if="lang==1">
										(P)
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="p" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										最大速度(RPM)
									</text>
									<text v-if="lang==1">
										(RPM)
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="rpm" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										霍尔接线顺序
									</text>
									<text v-if="lang==1">
										Hall wiring sequence
									</text>
								</view>
								<view class="right">

									<view class="check"> <!-- 1一线通 2霍尔 -->
										<uv-checkbox-group v-model="checkboxValue" label-color="#ffffff">
											<uv-checkbox :customStyle="{marginLeft: '8px'}"
												v-for="(items, indexs) in huoer_arr" :key="indexs" :label="items.name"
												:name="items.name"></uv-checkbox>
										</uv-checkbox-group>
									</view>
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										相线接线顺序
									</text>
									<text v-if="lang==1">
										相线接线顺序
									</text>
								</view>
								<view class="right">
									<view class="check"> <!-- 1一线通 2霍尔 -->
										<uv-checkbox-group v-model="checkboxValue1" label-color="#ffffff">
											<uv-checkbox inactiveColor="rgba(255,255,255,0.2)"
												:customStyle="{marginLeft: '8px'}"
												v-for="(items, indexs) in xiangxiang_arr" :key="indexs"
												:label="items.name" :name="items.name"></uv-checkbox>
										</uv-checkbox-group>
									</view>
								</view>
							</view>
						</view>



					</view>
				</view>

				<view class="nav_menus left">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										NTC使能
									</text>
									<text v-if="lang==1">
										NTC
									</text>
								</view>
								<view class="right">
									<view class="evan-switch">
										<evan-switch inactive-color="rgba(255,255,255,0.2)" size="26"
											active-color="#507AFe" v-model="ntc"></evan-switch>
									</view>
								</view>
							</view>
						</view>
						<view class="titie_body_line">

						</view>

						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										电机过温降额(℃)
									</text>
									<text v-if="lang==1">
										MOTD (℃)
									</text>
								</view>
								<view class="right">
									<input   v-model="dj_gw" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>

						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										电机恢复温度(℃)
									</text>
									<text v-if="lang==1">
										MRT (℃)
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="dj_hf" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										电机关断温度(℃)
									</text>
									<text v-if="lang==1">
										MST (℃)
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="dj_gd" type="text">
								</view>
							</view>
						</view>

					</view>
				</view>

				<view class="nav_menus left ">
					<view class="titie_bottom">
						<!-- <view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
											车轮类型
									</text>
									<text v-if="lang==1">
										wheel type
									</text>
								</view>
								<view class="right">
									<input disabled   v-model="s" type="text">
									<image class="rig_img" src="../../../static/right2.png"></image>
								</view>
							</view>
						</view>
						<view class="titie_body_line">
						</view>
						 -->
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										车轮尺寸
									</text>
									<text v-if="lang==1">
										Wheel size
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="cl_cc" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>

						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										中置驱动减速比(%)
									</text>
									<text v-if="lang==1">
										Mid mounted drive reduction ratio (%)
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="cl_zz" type="text">
								</view>
							</view>
						</view>
					</view>
				</view>
			</block>


			<block v-if="index==1&&clone_index==1">
				<view class="nav_menus left childers">
					<view class="titie_bottom">


						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										最大母线电流(A)
									</text>
									<text v-if="lang==1">
										Max Bus current(A)
									</text>
								</view>
								<view class="right">
									<input v-model="max_m_a" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line">
						</view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										最大相线电流(A)
									</text>
									<text v-if="lang==1">

										Max phase line (A)
									</text>
								</view>
								<view class="right">
									<input v-model="max_x_a" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										最大保护电压(A)
									</text>
									<text v-if="lang==1">
										Max Protect (V)
									</text>
								</view>
								<view class="right">
									<input v-model="max_b_v" type="text">
								</view>
							</view>
						</view>
						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										最大回馈电流(A)
									</text>
									<text v-if="lang==1">
										MaximumFeedback(A)
									</text>
								</view>
								<view class="right">
									<input v-model="max_h_a" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										MOS过温降额(℃)
									</text>
									<text v-if="lang==1">
										MOS Over Temp(℃)
									</text>
								</view>
								<view class="right">
									<input v-model="mos_g_je" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										MOS恢复温度(℃)
									</text>
									<text v-if="lang==1">
										MOS R Temp (℃)
									</text>
								</view>
								<view class="right">
									<input v-model="mos_hf" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										MOS关断温度(℃)
									</text>
									<text v-if="lang==1">

										MOS S temp (℃)
									</text>
								</view>
								<view class="right">
									<input v-model="mos_gd_w" type="text">
								</view>
							</view>
						</view>

					</view>
				</view>
			</block>


			<block v-if="index==2&&clone_index==2">
				<view class="nav_menus left childers">
					<view class="titie_bottom">

						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										额定电压(V)
									</text>
									<text v-if="lang==1">
										Rated voltage (V)
									</text>
								</view>
								<view class="right">
									<input v-model="ed_v" type="text">
									<!-- <image class="rig_img" src="../../../static/right2.png"></image> -->
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>

						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										过压保护(V)
									</text>
									<text v-if="lang==1">
										Over protection (V)
									</text>
								</view>
								<view class="right">
									<input v-model="gy_bh" type="text">
								</view>
							</view>
						</view>



						<view class="titie_body_line">

						</view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										欠压保护(V)
									</text>
									<text v-if="lang==1">

										Under protection (V)
									</text>
								</view>
								<view class="right">
									<input v-model="qy_bh" type="text">
								</view>
							</view>
						</view>


						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										欠压关断(V)
									</text>
									<text v-if="lang==1">
										Under shutdown (V)(℃)
									</text>
								</view>
								<view class="right">
									<input v-model="qy_gd" type="text">
								</view>
							</view>
						</view>


						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										充电电压(V)
									</text>
									<text v-if="lang==1">

										(V)
									</text>
								</view>
								<view class="right">
									<input v-model="ccd_v" type="text">
								</view>
							</view>
						</view>

					</view>
				</view>
			</block>

			<block v-if="index==3&&clone_index==3">
				<view class="nav_menus left childers">
					<view class="titie_bottom">

						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										过压保护(V)
									</text>
									<text v-if="lang==1">
										Over protection (V)
									</text>
								</view>
								<view class="right">
									<input   v-model="gy_bh" type="text">
									<!-- <image class="rig_img" src="../../../static/right2.png"></image> -->
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>

						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										开启电压(V)
									</text>
									<text v-if="lang==1">
										Opening voltage (V)
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="kq_dy" type="text">
								</view>
							</view>
						</view>



						<view class="titie_body_line">

						</view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										欠压保护(V)
									</text>
									<text v-if="lang==1">

										Under protection (V)
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="qy_bh" type="text">
								</view>
							</view>
						</view>
						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										骑行模式
									</text>
									<text v-if="lang==1">
										Riding mode
									</text>
								</view>
							
								<view class="right" @click="function_selection_openPicker(3)">
									<input disabled v-model="function_selection3[0][qx_ms]" type="text">
									<image class="rig_img" src="../../../static/right2.png"></image>
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										延迟时间(ms)
									</text>
									<text v-if="lang==1">
										Delay time (MS)
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="yc_sj" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										曲率阶数
									</text>
									<text v-if="lang==1">
										Curvature order
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="qljs" type="text">
								</view>
							</view>
						</view>


					</view>
				</view>
			</block>

			<block v-if="index==4&&clone_index==4">
				<view class="nav_menus left childers">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										D/Q轴开始增益 Kp
									</text>
									<text v-if="lang==1">
										D/Q-axis start gain KP
									</text>
								</view>
								<view class="right">
									<input   v-model="dq_s_kp" type="text">
									<!-- <image class="rig_img" src="../../../static/right2.png"></image> -->
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>

						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										D/Q轴中间增益 Kp
									</text>
									<text v-if="lang==1">
										D/Q-axis interme gain KP
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="dq_c_kp" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line">
						</view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										D/Q轴最终增益 Kp
									</text>
									<text v-if="lang==1">

										D/Q-axis final gain KP
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="dq_e_kp" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										D/Q轴开始增益 Ki
									</text>
									<text v-if="lang==1">

										D/Q-axis start gain
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="dq_s_ki" type="text">
								</view>
							</view>
						</view>
						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										D/Q轴中间增益 Ki
									</text>
									<text v-if="lang==1">
										DQ-axis interme gain ki
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()"  v-model="dq_c_ki" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										D/Q轴最终增益 Ki
									</text>
									<text v-if="lang==1">
										D/Q-axis final gain ki
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="dq_e_ki" type="text">
								</view>
							</view>
						</view>
					</view>

				</view>


				<view class="nav_menus left">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										母线环 Kp
									</text>
									<text v-if="lang==1">
										Bus ring KP
									</text>
								</view>
								<view class="right">
									<input   v-model="mx_kp" type="text">
									<!-- <image class="rig_img" src="../../../static/right2.png"></image> -->
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>

						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										母线环 Ki
									</text>
									<text v-if="lang==1">
										Bus ring Ki
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="mx_ki" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line">
						</view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										速度环 Kp
									</text>
									<text v-if="lang==1">

										Speed ring KP
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="sd_kp" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										速度环 Ki
									</text>
									<text v-if="lang==1">

										Speed ring ki
									</text>
								</view>
								<view class="right">
									<input @blur="ruoci()" v-model="sd_ki" type="text">
								</view>
							</view>
						</view>



					</view>
				</view>

			</block>

			<block v-if="index==5&&clone_index==5">
				<view class="nav_menus left childers">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										三速使能
									</text>
									<text v-if="lang==1">
										Three speed enable
									</text>
								</view>
								<view class="right">
									<view class="evan-switch">
										<evan-switch inactive-color="rgba(255,255,255,0.2)" size="26"
											active-color="#507AFe" v-model="ss_sn"></evan-switch>
									</view>
									<!-- <image class="rig_img" src="../../../static/right2.png"></image> -->
								</view>
							</view>
						</view>

						<view class="titie_body_line">

						</view>

						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										三速模式选择
									</text>
									<text v-if="lang==1">
										Three speed mode
									</text>
								</view>
								<view class="right" @click="function_selection_openPicker(2)">
									<input disabled v-model="function_selection2[0][ss_xz]" type="text">
									<image class="rig_img" src="../../../static/right2.png"></image>
								</view>
							</view>
						</view>
					</view>
				</view>

				<view class="nav_menus left">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										低速限速比例(%)
									</text>
									<text v-if="lang==1">
										Prop low speed limit(%)
									</text>
								</view>
								<view class="right">
									<input   v-model="ds_xx_bl" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										低速母线电流(A)
									</text>
									<text v-if="lang==1">
										Low speed bus (A)
									</text>
								</view>
								<view class="right">
									<input   v-model="ds_mx_a" type="text">

								</view>
							</view>
						</view>
						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										低速相线电流(A)
									</text>
									<text v-if="lang==1">
										Low speed phase line (A)
									</text>
								</view>
								<view class="right">
									<input  v-model="ds_xx_a" type="text">

								</view>
							</view>
						</view>




					</view>
				</view>

				<view class="nav_menus left">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										中速限速比例(%)
									</text>
									<text v-if="lang==1">
										M P speed limit (%)
									</text>
								</view>
								<view class="right">
									<input  v-model="zs_xx_bl" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										中速母线电流(A)
									</text>
									<text v-if="lang==1">
										M P bus (A)
									</text>
								</view>
								<view class="right">
									<input  v-model="zs_mx_a" type="text">

								</view>
							</view>
						</view>
						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										中速相线电流(A)
									</text>
									<text v-if="lang==1">
										M P phase line(A)
									</text>
								</view>
								<view class="right">
									<input v-model="zs_xx_a" type="text">

								</view>
							</view>
						</view>



					</view>
				</view>

				<view class="nav_menus left">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										高速限速比例(%)
									</text>
									<text v-if="lang==1">
										High speed limit (%)
									</text>
								</view>
								<view class="right">
									<input v-model="gs_xx_bl" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										高速母线电流(A)
									</text>
									<text v-if="lang==1">
										High speed bus (A)
									</text>
								</view>
								<view class="right">
									<input  v-model="gs_mx_a" type="text">

								</view>
							</view>
						</view>
						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										高速相线电流(A)
									</text>
									<text v-if="lang==1">
										High speed phase line(A)
									</text>
								</view>
								<view class="right">
									<input  v-model="gs_xx_a" type="text">

								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										弱磁电流(A)
									</text>
									<text v-if="lang==1">
										High speed field (A)
									</text>
								</view>
								<view class="right">
									<input  v-model="gs_rc_a" type="text">

								</view>
							</view>
						</view>



					</view>
				</view>

			</block>

			<block v-if="index==6&&clone_index==6">
				<view class="nav_menus left childers">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										氮气加速使能
									</text>
									<text v-if="lang==1">
										Manual acceleration
									</text>
								</view>
								<view class="right">
									<view class="evan-switch">
										<evan-switch inactive-color="rgba(255,255,255,0.2)" size="26"
											active-color="#507AFe" v-model="dq_sn"></evan-switch>
									</view>
								</view>
							</view>
						</view>

					<!-- 	<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										自动加速
									</text>
									<text v-if="lang==1">
										auto acceleration
									</text>
								</view>
								<view class="right">
									<view class="evan-switch">
										<evan-switch :disabled="dq_sn==false" inactive-color="rgba(255,255,255,0.2)" size="26"
											active-color="#507AFe" v-model="zd_js"></evan-switch>
									</view>
								</view>
							</view>
						</view> -->


						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										速度比例(%)
									</text>
									<text v-if="lang==1">
										Speed ratio (%)
									</text>
								</view>
								<view class="right">
									<input :disabled="dq_sn==false"  v-model="sd_bl" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										母线电流(A)
									</text>
									<text v-if="lang==1">
										Bus current (A)
									</text>
								</view>
								<view class="right">
									<input  :disabled="dq_sn==false"  v-model="b_mx_a" type="text">
								</view>
							</view>
						</view>
						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										相线电流(A)
									</text>
									<text v-if="lang==1">
										Phase line current (A)
									</text>
								</view>
								<view class="right">
									<input  :disabled="dq_sn==false"  v-model="b_xx_a" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										弱磁电流(A)
									</text>
									<text v-if="lang==1">
										Weak magnetic (A)
									</text>
								</view>
								<view class="right">
									<input :disabled="dq_sn==false"   v-model="b_rc_a" type="text">
								</view>
							</view>
						</view>



					</view>
				</view>

			</block>

			<block v-if="index==7&&clone_index==7">
				<view class="nav_menus left childers">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										倒车使能
									</text>
									<text v-if="lang==1">
										Reverse enable
									</text>
								</view>
								<view class="right">
									<view class="evan-switch">
										<evan-switch inactive-color="rgba(255,255,255,0.2)" size="26"
											active-color="#507AFe" v-model="dc_sn"></evan-switch>
									</view>
								</view>
							</view>
						</view>

						<!-- <view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										前进/倒退切换
									</text>
									<text v-if="lang==1">
										Forward/backward
									</text>
								</view>
								<view class="right">
									<view class="evan-switch">
										<evan-switch disabled inactive-color="rgba(255,255,255,0.2)" size="26" active-color="#507AFe"  v-model="s"></evan-switch>
									</view>
								</view>
							</view>
						</view> -->


						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										速度比例(%)
									</text>
									<text v-if="lang==1">
										Speed ratio (%)
									</text>
								</view>
								<view class="right">
									<input  :disabled="dc_sn==false"  v-model="dc_sd_bl" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										母线电流(A)
									</text>
									<text v-if="lang==1">
										Bus current (A)
									</text>
								</view>
								<view class="right">
									<input  :disabled="dc_sn==false"  v-model="dc_min_bl" type="text">
								</view>
							</view>
						</view>
						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										相线电流(A)
									</text>
									<text v-if="lang==1">
										Phase line current (A)
									</text>
								</view>
								<view class="right">
									<input :disabled="dc_sn==false"   v-model="dc_yc" type="text">
								</view>
							</view>
						</view>


					</view>
				</view>

			</block>

			<block v-if="index==8&&clone_index==8">
				<view class="nav_menus left childers">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										巡航使能
									</text>
									<text v-if="lang==1">
										Cruise Enable
									</text>
								</view>
								<view class="right">
									<view class="evan-switch">
										<evan-switch inactive-color="rgba(255,255,255,0.2)" size="26"
											active-color="#507AFe" v-model="xh_sn"></evan-switch>
									</view>
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										巡航方式
									</text>
									<text v-if="lang==1">
										Cruise Enable
									</text>
								</view>
								<view class="right">
									<input disabled   v-model="xf_type" type="text">
									<image class="rig_img" src="../../../static/right2.png"></image>
								</view>
							</view>
						</view>



						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										最小速度比例(%)
									</text>
									<text v-if="lang==1">
										Min speed ratio (%)
									</text>
								</view>
								<view class="right">
									<input :disabled="xh_sn==false" v-model="xh_minsd_bl" type="text">
								</view>
							</view>
						</view>
						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										延迟时间(ms)
									</text>
									<text v-if="lang==1">
										Delay time (ms)
									</text>
								</view>
								<view class="right">
									<input  :disabled="xh_sn==false"  v-model="hx_yc_time" type="text">
								</view>
							</view>
						</view>


					</view>
				</view>

			</block>

			<block v-if="index==9&&clone_index==9">
				<view class="nav_menus left childers">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										能量回收使能
									</text>
									<text v-if="lang==1">
										Energy recovery
									</text>
								</view>
								<view class="right">
									<view class="evan-switch">
										<evan-switch inactive-color="rgba(255,255,255,0.2)" size="26"
											active-color="#507AFe" v-model="nl_sn"></evan-switch>
									</view>
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										释放油门自动开启
									</text>
									<text v-if="lang==1">
										Release throttle and start
									</text>
								</view>
								<view class="right">
									<view class="evan-switch">
										<evan-switch inactive-color="rgba(255,255,255,0.2)" size="26"
											active-color="#507AFe" v-model="nl_sfym"></evan-switch>
									</view>
								</view>
							</view>
						</view>


						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										最小回收速度比例(%)
									</text>
									<text v-if="lang==1">
										Min recy rate ratio (%)
									</text>
								</view>
								<view class="right">
									<input  v-model="nl_minsd_bl" type="text">
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										最大回收母线电流(A)
									</text>
									<text v-if="lang==1">
										Max recovery bus (A)
									</text>
								</view>
								<view class="right">
									<input v-model="nl_maxmx_a" type="text">
								</view>
							</view>
						</view>
						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">

									<text v-if="lang==0">
										最大回收相线电流(A)
									</text>
									<text v-if="lang==1">
										M R PhaseLine(A)
									</text>
								</view>
								<view class="right">
									<input  v-model="nl_maxxx_a" type="text">
								</view>
							</view>
						</view>




					</view>
				</view>

			</block>

			<block v-if="index==10&&clone_index==10">
				<view class="nav_menus left childers">
					<view class="titie_bottom">
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										制动断电启用
									</text>
									<text v-if="lang==1">
										Brake power-off
									</text>
								</view>
								<view class="right">
									<view class="evan-switch">
										<evan-switch inactive-color="rgba(255,255,255,0.2)" size="26"
											active-color="#507AFe" v-model="cl_zd_qy"></evan-switch>
									</view>
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										侧边脚撑启用
									</text>
									<text v-if="lang==1">
										Side foot support enabled
									</text>
								</view>
								<view class="right">
									<view class="evan-switch">
										<evan-switch inactive-color="rgba(255,255,255,0.2)" size="26"
											active-color="#507AFe" v-model="cl_cb_qy"></evan-switch>
									</view>
								</view>
							</view>
						</view>


						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										停车挡启用
									</text>
									<text v-if="lang==1">
										Parking gear activated
									</text>
								</view>
								<view class="right">
									<view class="evan-switch">
										<evan-switch inactive-color="rgba(255,255,255,0.2)" size="26"
											active-color="#507AFe" v-model="cl_tc_qy"></evan-switch>
									</view>
								</view>
							</view>
						</view>

						<view class="titie_body_line"></view>
						<view class="titie_body">
							<view class="body_line">
								<view class="left">
									<text v-if="lang==0">
										延迟时间(ms)
									</text>
									<text v-if="lang==1">
										Delay time (ms)
									</text>
								</view>
								<view class="right">
									<input    v-model="cl_yc_time" type="text">
								</view>
							</view>
						</view>



					</view>
				</view>

			</block>

			<view class="bomt" @click="save_data()" v-if="index==clone_index">
				保存
			</view>
		</block>



		<view class="bottom">
			恢复出厂设置
		</view>





		<view style="width: 100%;height: 120rpx;float: left;"></view>

		<uv-picker ref="cj_picker" cancelColor="#fff" confirmColor="#fff" color="#ccc" activeColor="#fff"
			:confirmText="lang==1?'ok':'确定'" :cancelText="lang==1?'cancel':'取消'" :columns="changjia"
			@confirm="cj_confirm"></uv-picker>
		<uv-picker ref="xh_picker" cancelColor="#fff" confirmColor="#fff" color="#ccc" activeColor="#fff"
			:confirmText="lang==1?'ok':'确定'" :cancelText="lang==1?'cancel':'取消'" :columns="xinghao"
			@confirm="xh_confirm"></uv-picker>
		<uv-picker ref="dy_picker" cancelColor="#fff" confirmColor="#fff" color="#ccc" activeColor="#fff"
			:confirmText="lang==1?'ok':'确定'" :cancelText="lang==1?'cancel':'取消'" :columns="dianya"
			@confirm="dy_confirm"></uv-picker>
		<uv-picker ref="jb_picker" cancelColor="#fff" confirmColor="#fff" color="#ccc" activeColor="#fff"
			:confirmText="lang==1?'ok':'确定'" :cancelText="lang==1?'cancel':'取消'" :columns="jibie"
			@confirm="jb_confirm"></uv-picker>


		<uv-picker ref="function_selection_picker" cancelColor="#fff" confirmColor="#fff" color="#ccc"
			activeColor="#fff" :confirmText="lang==1?'ok':'确定'" :cancelText="lang==1?'cancel':'取消'"
			:columns="function_selection" @confirm="function_selection_confirm"></uv-picker>

		<uv-picker ref="function_selection_picker1" cancelColor="#fff" confirmColor="#fff" color="#ccc"
			activeColor="#fff" :confirmText="lang==1?'ok':'确定'" :cancelText="lang==1?'cancel':'取消'"
			:columns="function_selection1" @confirm="function_selection_confirm"></uv-picker>

		<uv-picker ref="function_selection_picker2" cancelColor="#fff" confirmColor="#fff" color="#ccc"
			activeColor="#fff" :confirmText="lang==2?'ok':'确定'" :cancelText="lang==1?'cancel':'取消'"
			:columns="function_selection2" @confirm="function_selection_confirm"></uv-picker>
			
		<uv-picker ref="function_selection_picker3" cancelColor="#fff" confirmColor="#fff" color="#ccc"
				activeColor="#fff" :confirmText="lang==2?'ok':'确定'" :cancelText="lang==1?'cancel':'取消'"
				:columns="function_selection3" @confirm="function_selection_confirm"></uv-picker>

		<tabbar :lang="lang" :current="3"></tabbar>
	</view>
</template>

<script>
	var app = getApp();
	import utils from "@/utils/util.js"
	// import { setTimeout } from '../../../utils/mqtt'
	const errorCode = {
		'-1': '已连接',
		10000: '未初始化蓝牙适配器',
		10001: '当前蓝牙适配器不可用',
		10002: '没有找到指定设备',
		10003: '连接失败',
		10004: '没有找到指定服务',
		10005: '没有找到指定特征值',
		10006: '当前连接已断开',
		10007: '当前特征值不支持此操作',
		10008: '其余所有系统上报的异常',
		10009: '系统版本低于 4.3 不支持 BLE',
		10010: '已连接',
		10011: '配对设备需要配对码',
		10012: '连接超时',
		10013: '连接 deviceId 为空或者是格式不正确',
	}

	export default {
		name: 'bluetooth',
		data() {
			return {
				nav_list: [{
						id: 0,
						title: "电机参数",
						en_title: "Motor parameters",
						img: "/static/dj.png"
					},
					{
						id: 1,
						title: "控制参数",
						en_title: "Control parameters",
						img: "/static/kz.png"
					},
					{
						id: 2,
						title: "电池参数",
						en_title: "Battery parameters",
						img: "/static/dc.png"
					},
					{
						id: 3,
						title: "油门参数",
						en_title: "Throttle parameters",
						img: "/static/ym.png"
					},
					{
						id: 4,
						title: "PI调节",
						en_title: "PI regulation",
						img: "/static/tj.png"
					},
					{
						id: 5,
						title: "三速功能",
						en_title: "Three speed function",
						img: "/static/ss.png"
					},
					{
						id: 6,
						title: "Boost功能",
						en_title: "Boost function",
						img: "/static/bg.png"
					},
					{
						id: 7,
						title: "倒车功能",
						en_title: "Reverse function",
						img: "/static/daoche.png"
					},
					{
						id: 8,
						title: "巡航功能",
						en_title: "Cruise function",
						img: "/static/xh.png"
					},
					{
						id: 9,
						title: "能量回收",
						en_title: "energy recovery",
						img: "/static/nl.png"
					},
					{
						id: 10,
						title: "车辆功能",
						en_title: "Vehicle functions",
						img: "/static/cl.png"
					}
				],
				checkboxValue: ['OABC'],
				checkboxValue1: ['OACB'],
				checkboxValue2: ['三速功能关闭'],
				// 基本案列数据
				checkboxList: [{
					name: 'OACB',
					disabled: false
				}, {
					name: 'OABC',
					disabled: false
				}],
				checkboxValue_d: ['点动开关'],
				checkboxList_d: [{
					name: '点动开关',
					disabled: false
				}, {
					name: '波动开关',
					disabled: false
				}],
				percent: 10,
				user_type: 0,
				lang: 0,
				huadong1: 0,
				huadong2: 0,
				changjia: [
					['普通', '绿源', '立马', '绿佳', '绿佳1', '光阳', '??-3', '??-4', '??-5', '??-6', '??-7', '??-8', '??-9',
						'??-10', '??-11', '??-12'
					]
				],
				xinghao: [
					['EM30', 'EM50', 'EM100', 'EM150', 'EM200', 'EM260', 'EM350', 'EM500']
				],
				dianya: [
					[48, 60, 72, 84, 96, 108]
				],
				jibie: [
					[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
				],
				huoer_arr: [{
					id: 0,
					name: 'OABC',
					disabled: false
				}, {
					id: 1,
					name: 'ABC',
					disabled: true
				}],
				xiangxiang_arr: [{
					id: 0,
					name: 'OABC',
					disabled: false
				}, {
					id: 1,
					name: 'ABC',
					disabled: true
				}],
				yibiao: [{
					id: 1,
					name: '拨动',
					disabled: false
				}, {
					id: 2,
					name: '点动',
					disabled: true
				}],
				shuangya: [{
					id: 1,
					name: '低速',
					disabled: false
				}, {
					id: 2,
					name: '中速',
					disabled: true
				}, {
					id: 3,
					name: '高速',
					disabled: true
				}],



				boxTop: uni.getMenuButtonBoundingClientRect().top - 4 + 'px',
				boxRight: 375 - uni.getMenuButtonBoundingClientRect().left + 20 + 'px',
				boxHeight: uni.getMenuButtonBoundingClientRect().top + uni.getMenuButtonBoundingClientRect().height + 4 +
					'px',
				banner: [{
					image: '../../../static/share2.png'
				}, {
					image: '../../../static/share2.png'
				}, {
					image: '../../../static/share2.png'
				}],
				// 是否初始化了蓝牙模块
				isInitBluetooth: false,
				// 是否搜索中
				isSearching: false,

				// 搜索到的设备列表
				deviceList: [],

				// 当前连接的蓝牙设备信息
				deviceInfo: {},
				// 当前连接的蓝牙设备的服务信息
				serviceInfo: {},
				// 支持 write 的特征值信息
				writeCharacteristicsInfo: {},
				// 支持 notify 或者 indicate 的特征值信息
				notifyCharacteristicsInfo: {},
				is_yuancheng: 0,
				is_biao: 0,
				clone_index: -1,
				index_type: 0,
				function_selection: [
					["SPM", "IPM"]
				],
				function_selection1: [
					["Hall-60", "Hall-120", "Encoder-512", "Encoder-1024"]
				],
				function_selection2: [
					["三速功能关闭", "拨动三速功能开启", "点动三速功能开启",
						"加减三速功能开启", "拨动两速功能开启", "点动两速功能开启", "加减两速功能开启"
					]
				],
				function_selection3: [
					["和挡位联动", "柔和", "普通","运动"]
				],
				// xiangxiang_arr: [{
				// 	id:0,
				// 	name: '三速功能关闭',
				// 	disabled: false
				// }, {
				// 	id:1,
				// 	name: '拨动三速功能开启',
				// 	disabled: true
				// }, {
				// 	id:1,
				// 	name: '点动三速功能开启',
				// 	disabled: true
				// }, {
				// 	id:1,
				// 	name: '加减三速功能开启',
				// 	disabled: true
				// }, {
				// 	id:1,
				// 	name: '拨动两速功能开启',
				// 	disabled: true
				// }, {
				// 	id:1,
				// 	name: '点动两速功能开启',
				// 	disabled: true
				// }, {
				// 	id:1,
				// 	name: '加减两速功能开启',
				// 	disabled: true
				// }],

				dianji_type: 0,
				chuanganqi_type: 0,
				xiangyijiao: "",
				dianjineizu: "",
				ld: "",
				lq: "",
				ke: "",
				p: "",
				rpm: "",
				ntc: false,
				dj_gw: "",
				dj_hf: "",
				dj_gd: "",
				cl_type: "",
				cl_cc: "",
				cl_zz: "",

				mos_num: "",
				max_m_a: "",
				max_x_a: "",
				max_b_v: "",
				max_h_a: "",
				mos_g_je: "",
				mos_hf: "",
				mos_gd_w: "",

				ed_v: "",
				gy_bh: "",
				qy_bh: "",
				qy_gd: "",
				cd_v: "",
				ccd_v:"",



				gy_bh: "",
				qy_bh: "",
				kq_dy: "",
				qx_ms: "",
				yc_sj: "",
				qljs: "",

				dq_s_kp: "",
				dq_c_kp: "",
				dq_e_kp: "",
				dq_s_ki: "",
				dq_c_ki: "",
				dq_e_ki: "",
				mx_kp: "",
				mx_ki: "",
				sd_kp: "",
				sd_ki: "",


				ss_sn: false,
				ss_xz: 0,
				ds_xx_bl: 0,
				ds_mx_a: 0,
				ds_xx_a: 0,
				zs_xx_bl: 0,
				zs_mx_a: 0,
				zs_xx_a: 0,
				zs_rc_a: 0,
				gs_xx_bl: 0,
				gs_mx_a: 0,
				gs_xx_a: 0,
				gs_rc_a: 0,

				dq_sn: false,
				zd_js: false,
				zd_js_data:null,
				sd_bl: "",
				b_mx_a: "",
				b_xx_a: "",
				b_rc_a: "",


				dc_sn: false,
				dc_sn_data:"",
				dc_sd_bl: "",
				dc_min_bl: "",
				dc_yc: "",

				xh_sn: false,
				xh_type: "",
				xh_minsd_bl:"",
				hx_yc_time:"",
				
				
				
				nl_sn:"",
				nl_sfym:"",
				nl_minsd_bl:"",
				nl_maxmx_a:"",
				nl_maxxx_a:"",
				
				cl_zd_qy:"",
				cl_cb_qy:"",
				cl_tc_qy:"",
				cl_yc_time:""

			}
		},
		onHide() {
			console.log("mv11", this.data.softstart_level_index)
			app.globalData.is_rw = 1;
			uni.setStorageSync('dev_data', this.data);
		},
		onUnload() {
			console.log("mv")
			app.globalData.is_rw = 1;
			uni.setStorageSync('dev_data', this.data);

		},
		onShow() {

			this.show_on();
		},
		onLoad() {
			uni.hideTabBar();

			app.globalData.is_rw = 1;
			//获取特征值
			// that.getBLEDeviceCharacteristics();

			//handleConnectDevice
			//要去他的页面的
		},
		methods: {
			save_data() {
				let index = this.clone_index
				let values = "";
				let send_data = [];
				let left_bnt_arr = [];
				console.log("index0", index)
				
				function xiru_arr(left_bnt_arr,send_data,that){
					let item = left_bnt_arr[0]
					if (left_bnt_arr && left_bnt_arr.length > 0) {
						uni.onBLECharacteristicValueChange((res) => {
							const value = Array.prototype.map.call(
								new Uint8Array(res.value), (bit) => bit)
						console.log("写入参数返回值_str", that.$util.ab2hext_str(
							value))
							
								let new_arr = left_bnt_arr.slice(1)
								xiru_arr(new_arr,send_data,that)
						
						})
						
						let sdata = that.$util.fensan_zijie(send_data[item]);
						let values = [0xaa, 10, 0x00, 0x10, 0x01, 0x03,
							// 0x80,0x00,//可配置IO口位置1
							parseInt(item.substr(0, 2), 16),
							parseInt(item.substr(2, 2), 16),
							sdata[0],
							sdata[1]
						];
						console.log("item",item)
						console.log(that.$util.ab2hext_str(values))
						
						that.handleWriteValue_w(values);
						
					}else{
					
						console.log("left_bnt_arr",left_bnt_arr)
						uni.showToast({
							title: "写入成功"
						})
					}
					
				}
				
				
				switch (index) {
					case 0:

						break;
					case 1: //控制参数
						left_bnt_arr = [ "3500", "3600", "3700", "0800", "3900"
						, "3B00", "3A00"
						];
						send_data["3500"] = this.max_m_a * 10;
						send_data["3600"] = this.max_x_a * 10;
						send_data["3700"] = this.max_b_v * 10;
						send_data["0800"] = this.max_h_a * 10;
						send_data["3900"] = this.mos_g_je * 1 + 60;
						
						send_data["3B00"] = this.mos_hf * 1 + 60;
						send_data["3A00"] = this.mos_gd_w * 1 + 60;
						console.log(send_data, 9797)
						xiru_arr(left_bnt_arr,send_data,this)
						
						break;
					case 2: //电池参数
					
						left_bnt_arr = [  "2000", "2100", "2200", "2300", "2800"
						];
						send_data["2000"] = this.ed_v;
						send_data["2100"] = this.gy_bh * 10;
						send_data["2200"] = this.qy_bh * 10;
						send_data["2300"] = this.qy_gd * 10;
						send_data["2800"] = this.ccd_v;
						console.log(send_data, 9797)
						xiru_arr(left_bnt_arr,send_data,this)
						break;
					case 3:
						// 0x20,0x00,//过压保护(V)  * 0.1  gy_bh
						// 0x32,0x02,//开启电压(V) * 0.1   
						// 0x21,0x00,//欠压保护(V)  * 0.1    qy_bh
						// 0x33,0x02,//骑行模式(V)  -60 
						// 0x36,0x02,//延迟时间(V)  
						// 0x37,0x02,//曲率阶数(V)    777777
						left_bnt_arr = ["2000", "3202", "2100", "3302", "3602", "3702"];
						
						send_data["2000"] = this.gy_bh * 10;
						send_data["3202"] = this.kq_dy * 10;
						send_data["2100"] = this.qy_bh * 10;
						send_data["3302"] = this.qx_ms;
						send_data["3602"] = this.yc_sj;
						send_data["3702"] = this.qljs * 1000;
						console.log(send_data, 9797)
						xiru_arr(left_bnt_arr,send_data,this)
						

						break; //pi调节
					case 4:
						left_bnt_arr = ["0200", "0202", "0402", "0102", "0302", "0502"
						, "0602", "0702", "0802", "0902"
						];

						send_data["0200"] = this.dq_s_kp* 1000;;
						send_data["0202"] = this.dq_c_kp * 1000;
						send_data["0402"] = this.dq_e_kp * 1000;

						send_data["0201"] = this.dq_s_ki* 10000;
						send_data["0302"] = this.dq_c_ki* 10000;
						send_data["0502"] = this.dq_e_ki* 10000;


						send_data["0602"] = this.mx_kp* 1000;
						send_data["0702"] = this.mx_ki* 10000;
						send_data["0802"] = this.sd_kp* 1000;
						send_data["0902"] = this.sd_ki* 10000;

						console.log(send_data, 9797)
						xiru_arr(left_bnt_arr,send_data,this)
						break;
					case 5: //三速功能
						left_bnt_arr = [
							"4000", "4200", "4300", "4400", "4600", "4700", "4800",
							"4b00", "4c00", "4d00", "4e00"
						];

						//三速使能 三速模式选择
						/*
						0：三速功能关闭           1：拨动三速功能开启
						2：点动三速功能开启       3：加减三速功能开启
						4：拨动两速功能开启       5：点动两速功能开启
						6：加减两速功能开启
						*/
							console.log("this.ds_xx_bl",this.ds_xx_bl)
						send_data["4000"] = this.ss_xz;
						
						send_data["4200"] = this.ds_xx_bl;
						send_data["4300"] = this.ds_mx_a * 100;
						send_data["4400"] = this.ds_xx_a * 100;

						send_data["4600"] = this.zs_xx_bl;
						send_data["4700"] = this.zs_mx_a * 10;
						send_data["4800"] = this.zs_xx_a * 10;

						send_data["4b00"] = this.gs_xx_bl;
						send_data["4c00"] = this.gs_mx_a * 100;
						send_data["4d00"] = this.gs_xx_a * 100;
						send_data["4e00"] = this.gs_rc_a * 100;

						console.log(send_data, 9797)
						xiru_arr(left_bnt_arr,send_data,this)
						break;
						case 6:
							left_bnt_arr = ["2002", "2102", "2202", "2302"];
						
				
							// send_data["a1f0"] = this.$util.set_bit(this.zd_js_data,1,2)
							send_data["2002"] = this.sd_bl
							send_data["2102"] = this.b_mx_a * 100;
							
							send_data["2202"] = this.b_xx_a* 10
							send_data["2302"] = this.b_rc_a* 10;
							
							console.log(send_data, 9797)
								xiru_arr(left_bnt_arr,send_data,this)
						break;
						case 7://倒车
						
						this.dc_sn_data = 
							left_bnt_arr = ["4000","5500", "5600", "5700"];
							
							
							send_data["4000"] = this.$util.set_bit(this.dc_sn_data,this.dc_sn==true?1:0,5,1)
							send_data["5500"] = this.dc_sd_bl
							send_data["5600"] = this.dc_min_bl 
							send_data["5700"] = this.dc_yc
							console.log(send_data, 9797)
								xiru_arr(left_bnt_arr,send_data,this)
						break;
						case 8://巡航功能
							left_bnt_arr = [ "0b01", "0c01"];
							// send_data["0400"] = this.sd_bl
							send_data["0b01"] = this.xh_minsd_bl
							send_data["0c01"] = this.hx_yc_time
							//.hx_yc_time
							
							console.log(send_data, 9797)
							xiru_arr(left_bnt_arr,send_data,this)
						break;
						case 9://能量回收
									
							left_bnt_arr = [ "010d", "0027","004f"];
							// send_data["0400"] = this.sd_bl
							send_data["010d"] = this.dc_min_bl
							send_data["0027"] = this.nl_maxmx_a * 10
							send_data["004f"] = this.nl_maxxx_a * 10
							console.log(send_data, 9797)
							xiru_arr(left_bnt_arr,send_data,this)
						break;
						case 10://车辆功能
							left_bnt_arr = [ "010a"];
							// send_data["0400"] = this.sd_bl
							send_data["010a"] = this.cl_yc_time
							xiru_arr(left_bnt_arr,send_data,this)
						
						break;
				}
				
			},
			function_selection_confirm(e) {
				console.log("e.indexs[0]",this.index_type)
				// 如果 选择的是 18 19 20 21
				switch (this.index_type) {
					case 0:
						this.dianji_type = e.indexs[0];
						break;
					case 1:
						this.chuanganqi_type = e.indexs[0];
						break;
					case 2:
						this.ss_xz = e.indexs[0];
						break;
					case 3:
						this.qx_ms = e.indexs[0];
						break;	
				}
			},
			function_selection_openPicker(type) {

				this.index_type = type
				console.log("this.ss_sn",this.ss_sn)
				switch (type) {
					case 0:
						this.$refs.function_selection_picker.open();
						break;
					case 1:
						this.$refs.function_selection_picker1.open();
						break;
					case 2:
						if(this.ss_sn == true){
							this.$refs.function_selection_picker2.open();
						}
						break;
					case 3:
						this.$refs.function_selection_picker3.open();
						break;	
				}


			},
			xuanze() {
				console.log(this.data.output_type_selcet_value);;

			},
			cli_clones(index) {
				//先读取参数？

				if (this.clone_index == index) {
					this.clone_index = -1;
				} else {
					this.clone_index = index;
				}
				if (app.globalData.connected == true) {
					let values = [];
					switch (this.clone_index) {
						case 0: //电机参数
							this.data = uni.getStorageSync('dev_data');
							uni.onBLECharacteristicValueChange((res) => {
								const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)

								console.log("电机参数监听到的参数971", this.$util.ab2hext_str(value))
								let splitResult = this.$util.ab2hext_str(value);
								if (splitResult[5] == "01") {
									//心跳？
									console.log("xintiao");
								} else {
									let hexString = value; // 要分割的十六进制字符串

									//可配置IO口位置1
									let pro_address1 = this.$util.hebing_zijie(splitResult[6], splitResult[7])
									console.log("pro_address1", pro_address1)
									this.dianji_type = pro_address1;

									//可配置IO口位置2
									let pro_address2 = this.$util.hebing_zijie(splitResult[8], splitResult[9])
									console.log("pro_address2", pro_address2)
									this.chuanganqi_type = pro_address2

									this.xiangyijiao = parseInt(splitResult[11] + splitResult[10], 16) - 180
									this.dianjineizu = parseInt(splitResult[13] + splitResult[12], 16) * 0.1
									this.ld = (parseInt(splitResult[15] + splitResult[14], 16) * 0.1).toFixed(1)
									this.lq = (parseInt(splitResult[17] + splitResult[16], 16) * 0.1).toFixed(1)
									this.ke = (parseInt(splitResult[19] + splitResult[18], 16) * 0.1).toFixed(1)
									this.p = (parseInt(splitResult[21] + splitResult[20], 16)).toFixed(1)
								
								
								
								
										uni.onBLECharacteristicValueChange((res) => {
											const value = Array.prototype.map.call(new Uint8Array(res.value), (
												bit) => bit)
											console.log("电机参数监听到的参数972", this.$util.ab2hext_str(value))
											let splitResult = this.$util.ab2hext_str(value);
											if (splitResult[5] == "01") {
												//心跳？
												console.log("xintiao2");
											} else {
												let hexString = value; // 要分割的十六进制字符串
										
												this.rpm = parseInt(splitResult[7] + splitResult[6], 16)
										
										
												let pro_address1 = this.$util.hebing_zijie(splitResult[8],
													splitResult[9])
												pro_address1 = pro_address1 == 1 ? 1 : 0;
												console.log("checkboxValue", pro_address1, this.huoer_arr[
													pro_address1])
												this.checkboxValue = [this.huoer_arr[pro_address1].name];
												//可配置IO口位置2
												let pro_address2 = this.$util.hebing_zijie(splitResult[10],
													splitResult[11])
												pro_address2 = pro_address2 == 1 ? 1 : 0;
												this.checkboxValue1 = [this.xiangxiang_arr[pro_address2].name]
												console.log("this.checkboxValue1", this.checkboxValue1)
										
												let pro_address3 = this.$util.hebing_zijie(splitResult[12],
													splitResult[13])
												console.log("nfc", pro_address3)
												this.nfc = pro_address3 == 0 ? true : false;
										
												//dj_gw
												this.dj_gw = (parseInt(splitResult[15] + splitResult[14], 16) - 60)
													.toFixed(1)
												console.log("dj_gw", this.dj_gw)
										
												this.dj_hf = (parseInt(splitResult[17] + splitResult[16], 16) - 60)
													.toFixed(1)
												console.log("dj_gw", this.dj_gw)
										
												this.dj_gd = (parseInt(splitResult[19] + splitResult[18], 16))
													.toFixed(1)
												console.log("dj_gd", this.dj_gd)
										
												this.cl_cc = (parseInt(splitResult[21] + splitResult[20], 16))
													.toFixed(1)
												console.log("cl_cc", this.cl_cc)
										
												this.$forceUpdate()
												
												uni.onBLECharacteristicValueChange((res) => {
													const value = Array.prototype.map.call(new Uint8Array(res
														.value), (bit) => bit)
													console.log("电机参数监听到的参数973", value)
													let splitResult = this.$util.ab2hext_str(value);
													if (splitResult[5] == "01") {
														//心跳？
														console.log("xintiao3");
													} else {
														this.cl_zz = parseInt(splitResult[7] + splitResult[6],
															16) * 0.0025
														console.log("cl_zz", this.cl_zz)
													}
												})
												values = [0xaa, 8, 0x00, 0x10, 0x01, 0x05,
													0x00, 0x12, //中置驱动减速比 减速比 * 0.0025
												];
												console.log("发送数据973")
												this.handleWriteValue_w(values);
										
											}
										
											// this.rpm = parseInt(splitResult[13]+splitResult[12],16)
										})
										values = [0xaa, 22, 0x00, 0x10, 0x01, 0x05,
											0x02, 0x00, //最大速度 * 1
											0x0B, 0x00, //霍尔接线顺序 /*0x01:  ABC 0x02:  ACB*/
											0x10, 0x00, //相线接线顺序/*0x01:  ABC 0x02:  ACB*/
											0x0c, 0x00, //ntc使能 电机设置【电机热敏电阻】 0x00:无NTC ; >0x00:  有NTC, NTC型号   
											0x0d, 0x00, //电机过热降额 -60
											0x0f, 0x00, //电机恢复温度 -60
											0x0E, 0x00, //电机关断温度 -60
											// 0x00,0x10,//车轮类型
											0x11, 0x00, //车轮尺寸  周长 * 0.1
											// 0x00,0x12,//中置驱动减速比 减速比 * 0.0025
										];
										console.log("发送数据972")
										this.handleWriteValue_w(values);
									
								
								}
							})

							values = [0xaa, 22, 0x00, 0x10, 0x01, 0x05,
								0x01, 0x00, //电机类型  0x1: SPM 0x2: IPM
								0x07, 0x00, //传感器类型

								0x08, 0x00, //偏移角  - 180
								0x05, 0x00, //电机内阻  * 0.1
								0x03, 0x00, //D轴电感  * 0.1
								0x04, 0x00, //Q轴电感 * 0.1
								0x06, 0x00, //反电势 vr,s/krpm * 0.1
								0x09, 0x00, //极对数 * 1

								// 0x00,0x0B,//霍尔接线顺序
								// 0x00,0x10,//相线接线顺序
							];
							console.log("发送数据971")
							this.handleWriteValue_w(values);
							//需要知道接下来的数据
					
								
						
							break;

						case 1: //控制参数
							this.data = uni.getStorageSync('dev_data');
							uni.onBLECharacteristicValueChange((res) => {
								const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
								console.log("控制参数监听到的参数971", value)
								let splitResult = this.$util.ab2hext_str(value);
								if (splitResult[5] == "01") {
									//心跳？
									console.log("xintiao4");
								} else {
									this.mos_num = parseInt(splitResult[7] + splitResult[6], 16)
									console.log("mos_num", this.mos_num)

									this.max_m_a = parseInt(splitResult[9] + splitResult[8], 16) * 0.1
									console.log(".max_m_a", this.max_m_a)

									this.max_x_a = parseInt(splitResult[11] + splitResult[10], 16) * 0.1
									console.log("max_x_a", this.max_x_a)

									this.max_b_v = parseInt(splitResult[13] + splitResult[12], 16) * 0.1
									console.log("max_b_v", this.max_b_v)

									this.max_h_a = parseInt(splitResult[15] + splitResult[14], 16) * 0.1
									console.log("max_h_a", this.max_h_a)

									this.mos_g_je = parseInt(splitResult[17] + splitResult[16], 16) - 60
									console.log("mos_g_je", this.mos_g_je)

									this.mos_hf = parseInt(splitResult[19] + splitResult[18], 16) - 60
									console.log("mos_hf", this.mos_hf)

									this.mos_gd_w = parseInt(splitResult[21] + splitResult[20], 16) - 60
									console.log("mos_gd_w", this.mos_gd_w)
								}
							})

							values = [0xaa, 0x16, 0x00, 0x10, 0x01, 0x05,
								0x34, 0x00, //MOS管个数 
								0x35, 0x00, //最大母线电流(A)  * 0.1
								0x36, 0x00, //最大相线电流(A)	* 0.1

								0x37, 0x00, //最大保护电压 * 0.1
								0x08, 0x00, //最大弱磁电流(A)  最大回馈电流 * 0.1

								0x39, 0x00, //MOS过温降额(℃)  -60
								0x3B, 0x00, //MOS恢复温度(℃)  -60
								0x3A, 0x00, //MOS关断温度(℃)  60
							];
							console.log("控制参数发送数据")
							this.handleWriteValue_w(values);
							//需要知道接下来的数据
							break;
						case 2: //电池参数
							this.data = uni.getStorageSync('dev_data');
							uni.onBLECharacteristicValueChange((res) => {
								const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
								console.log("电池参数监听到的参数971", this.$util.ab2hext_str(value))
								let splitResult = this.$util.ab2hext_str(value);
								if (splitResult[5] == "01") {
									//心跳？
									console.log("xintiao5");
								} else {
									this.ed_v = (parseInt(splitResult[7] + splitResult[6], 16)).toFixed(1)
									console.log("ed_v", this.ed_v)

									this.gy_bh = (parseInt(splitResult[9] + splitResult[8], 16) * 0.1).toFixed(1)
									console.log("gy_bh", this.gy_bh)

									this.qy_bh = (parseInt(splitResult[11] + splitResult[10], 16) * 0.1).toFixed(1)
									console.log("qy_bh", this.qy_bh)

									this.qy_gd = (parseInt(splitResult[13] + splitResult[12], 16) * 0.1).toFixed(1)
									console.log("qy_gd", this.qy_gd)

									this.ccd_v = parseInt(splitResult[15] + splitResult[14], 16)
									console.log("ccd_v", this.ccd_v)

									this.$forceUpdate()
								}

							})
							values = [0xaa, 16, 0x00, 0x10, 0x01, 0x05,
								0x20, 0x00, //额定电压(V)  ed_v
								0x21, 0x00, //过压保护(V)  * 0.1  gy_bh
								0x22, 0x00, //欠压保护(V)  * 0.1    qy_bh
								0x23, 0x00, //欠压关断(V) * 0.1	qy_gd	
								0x28, 0x00, //充电电压(V)   77777 cd_v
								// 0x00,0x10,//相线接线顺序
							];
							console.log("电池参数发送数据")
							this.handleWriteValue_w(values);
							//需要知道接下来的数据
							break;
						case 3: //油门参数
							this.data = uni.getStorageSync('dev_data');
							uni.onBLECharacteristicValueChange((res) => {
								const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)

								let splitResult = this.$util.ab2hext_str(value);
								console.log("油门参数监听到的参数971", splitResult)
								if (splitResult[5] == "01") {
									//心跳？
									console.log("xintiao5");
								} else {
									// qljs:"",
									// gy_bh:"",
									// qy_bh:"",
									// qx_ms:"",
									// yc_sj:"",
									// qljs:""



									this.gy_bh = (parseInt(splitResult[7] + splitResult[6], 16) * 0.1).toFixed(1)
									console.log("gy_bh", this.gy_bh)

									this.kq_dy = (parseInt(splitResult[9] + splitResult[8], 16) * 0.1).toFixed(1)
									console.log("kq_dy", this.kq_dy)

									this.qy_bh = (parseInt(splitResult[11] + splitResult[10], 16) * 0.1).toFixed(1)
									console.log("qy_bh", this.qy_bh)

									this.qx_ms = parseInt(splitResult[13] + splitResult[12], 16)
									console.log("qx_ms", this.qx_ms)

									this.yc_sj = parseInt(splitResult[15] + splitResult[14], 16)
									console.log("yc_sj", this.yc_sj)

									this.qljs = (parseInt(splitResult[17] + splitResult[16], 16) * 0.001).toFixed(
										1)
									console.log("qljs", this.qljs)
								}

							})

							values = [0xaa, 0x12, 0x00, 0x10, 0x01, 0x05,

								0x20, 0x00, //过压保护(V)  * 0.1  gy_bh
								0x32, 0x02, //开启电压(V) * 0.1   

								0x21, 0x00, //欠压保护(V)  * 0.1    qy_bh
								0x33, 0x02, //骑行模式(V)  -60 

								0x36, 0x02, //延迟时间(V)  60  777777
								0x37, 0x02, //曲率阶数(V)    777777

							];
							console.log("油门参数发送数据")
							this.handleWriteValue_w(values);
							//需要知道接下来的数据
							break;
						case 4: //PI调节
							this.data = uni.getStorageSync('dev_data');
							uni.onBLECharacteristicValueChange((res) => {
								const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)

								let splitResult = this.$util.ab2hext_str(value);
								console.log("PI调节参数监听到的参数971", splitResult)
								if (splitResult[5] == "01") {
									//心跳？
									console.log("xintiao7");
								} else {

									this.dq_s_kp = (parseInt(splitResult[7] + splitResult[6], 16) * 0.001).toFixed(1)
									console.log("dq_s_kp", this.dq_s_kp)

									this.dq_c_kp = ( parseInt(splitResult[9] + splitResult[8], 16) * 0.001).toFixed(1)
									console.log("dq_c_kp", this.dq_c_kp)

									this.dq_e_kp = (parseInt(splitResult[11] + splitResult[10], 16) * 0.001).toFixed(1)
									console.log("dq_e_kp", this.dq_e_kp)

									this.dq_s_ki = ( parseInt(splitResult[13] + splitResult[12], 16) * 0.0001)
									console.log("dq_s_ki", this.dq_s_ki)

									this.dq_c_ki =( parseInt(splitResult[15] + splitResult[14], 16) * 0.0001)
									console.log("dq_c_ki", this.dq_c_ki)

									this.dq_e_ki = (parseInt(splitResult[17] + splitResult[16], 16) * 0.0001)
									console.log("dq_e_ki", this.dq_e_ki)
									
										setTimeout(()=>{
											uni.onBLECharacteristicValueChange((res) => {
												const value = Array.prototype.map.call(new Uint8Array(res.value), (
													bit) => bit)
											
												let splitResult = this.$util.ab2hext_str(value);
												console.log("PI调节参数监听到的参数972", splitResult)
												if (splitResult[5] == "01") {
													//心跳？
													console.log("xintiao7");
												} else {
											
													this.mx_kp = (parseInt(splitResult[7] + splitResult[6], 16) * 0.001).toFixed(1)
													console.log("mx_kp", this.mx_kp)
											
													this.mx_ki = (parseInt(splitResult[9] + splitResult[8], 16) * 0.0001).toFixed(1)
													console.log("mx_ki", this.mx_ki)
											
													this.sd_kp = (parseInt(splitResult[11] + splitResult[10], 16) *0.001).toFixed(1)
													console.log("sd_kp", this.sd_kp)
											
													this.sd_ki = (parseInt(splitResult[13] + splitResult[12], 16) *0.0001).toFixed(1)
													console.log("sd_ki", this.sd_ki)
											
											
												}
											})
											values = [0xaa, 14, 0x00, 0x10, 0x01, 0x05,
												0x06, 0x02,
												0x07, 0x02,
												0x08, 0x02,
												0x09, 0x02,
											];
											console.log("PI调节发送数据972")
											this.handleWriteValue_w(values);
										},100)
								

								}
							})
							//dq_s_kp
							values = [0xaa, 18, 0x00, 0x10, 0x01, 0x05,

								0x02, 0x00, //D/Q开始增益KPi  * 0.001
								0x02, 0x02, //D/Q轴中间增益KPi * 0.1   777777
								0x04, 0x02, //D/Q轴最终增益  * 0.1    qy_bh
								0x01, 0x02, //D/Q轴开始增益  -60 
								0x03, 0x02, //D/Q轴中间增益  60  777777
								0x05, 0x02, //D/Q轴最终增益    777777
								// 0x00,0x10,//相线接线顺序
							];
							console.log("PI调节发送数据971")
							t
							// values = [0xaa, 22, 0x00, 0x10, 0x01, 0x05,
							// 	0x02, 0x00, //最大速度 * 1
							// 	0x0B, 0x00, //霍尔接线顺序 /*0x01:  ABC 0x02:  ACB*/
							// 	0x10, 0x00, //相线接线顺序/*0x01:  ABC 0x02:  ACB*/
							// 	0x0c, 0x00, //ntc使能 电机设置【电机热敏电阻】 0x00:无NTC ; >0x00:  有NTC, NTC型号   
							// 	0x0d, 0x00, //电机过热降额 -60
							// 	0x0f, 0x00, //电机恢复温度 -60
							// 	0x0E, 0x00, //电机关断温度 -60
							// 	// 0x00,0x10,//车轮类型
							// 	0x11, 0x00, //车轮尺寸  周长 * 0.1
							// 	// 0x00,0x12,//中置驱动减速比 减速比 * 0.0025
							// ];
							// console.log("发送数据971")
							// this.handleWriteValue_w(vhis.handleWriteValue_w(values);
							//需要知道接下来的数据alues);
						

						
							break;

						case 5: //三速功能
							this.data = uni.getStorageSync('dev_data');
							uni.onBLECharacteristicValueChange((res) => {
								const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)

								//ds_xx_bl
								let splitResult = this.$util.ab2hext_str(value);
								console.log("三速功能参数监听到的参数971", splitResult)
								if (splitResult[5] == "01") {
									//心跳？
									console.log("xintiao8");
								} else {
									let pro_address1 = this.$util.hebing_zijie(splitResult[6], splitResult[7])
									
									this.ss_sn = pro_address1 == 0 ? false : true;
									
									let s1 = this.$util.get_bit(pro_address1, 0, 4);
									console.log("s1", s1)
											
									this.ss_xz = s1;
									pro_address1 = this.$util.get_bit(pro_address1, 0, 1)	

									this.ds_xx_bl = parseInt(splitResult[9] + splitResult[8], 16).toFixed(1)
									console.log("ds_xx_bl", this.ds_xx_bl)

									this.ds_mx_a = (parseInt(splitResult[11] + splitResult[10], 16) * 0.01).toFixed(1)
									console.log("ds_mx_a", this.ds_mx_a)

									this.ds_xx_a = (parseInt(splitResult[13] + splitResult[12], 16) * 0.01).toFixed(1)
									console.log("ds_xx_a", this.ds_xx_a)

									this.zs_xx_bl = parseInt(splitResult[15] + splitResult[14], 16)
									console.log("zs_xx_bl", this.zs_xx_bl)

									this.zs_mx_a = (parseInt(splitResult[17] + splitResult[16], 16) * 0.1).toFixed(1)
									console.log("zs_mx_a", this.zs_mx_a)

									this.zs_xx_a = (parseInt(splitResult[19] + splitResult[18], 16) * 0.1).toFixed(1)
									console.log("zs_xx_a", this.zs_xx_a)
										
										setTimeout(()=>{
											uni.onBLECharacteristicValueChange((res) => {
												const value = Array.prototype.map.call(new Uint8Array(res.value), (
													bit) => bit)
												let splitResult = this.$util.ab2hext_str(value);
												console.log("三速功能参数监听到的参数972", splitResult)
												if (splitResult[5] == "01") {
													//心跳？
													console.log("xintiao9");
												} else {
											
													this.gs_xx_bl = parseInt(splitResult[7] + splitResult[6], 16)
													console.log("gs_xx_bl", this.gs_xx_bl)
											
													this.gs_mx_a = (parseInt(splitResult[9] + splitResult[8], 16) * 0.01).toFixed(1)
													console.log("gs_mx_a", this.gs_mx_a)
											
													this.gs_xx_a = (parseInt(splitResult[11] + splitResult[10], 16) *0.01).toFixed(1)
													console.log("gs_xx_a", this.gs_xx_a)
											
													this.gs_rc_a = (parseInt(splitResult[13] + splitResult[12], 16) *0.01).toFixed(1)
													console.log("gs_rc_a ", this.gs_rc_a)
											
												}
											})
											//0xaa,  0x0c,    0x00,    0x10,
											//0x01, 0x01
											//报文头	 报文长度   帧序列号	帧数据	
											//设备id ，报文命令
											//0x0001	电机设置【电机类型】
											values = [0xaa, 14, 0x00, 0x10, 0x01, 0x05,
												// 0x49,0x00,//中速弱磁电流(A) * 0.1
												0x4b, 0x00, //高速限速比例(%)
												0x4c, 0x00, //高速母线电流(A) * 0.1
												0x4d, 0x00, //高速相线电流(A) * 0.1
												0x4e, 0x00, //高速弱磁电流(A) * 0.1
											];
											console.log("三速功能三速功能发送数据972")
											this.handleWriteValue_w(values);
										},150)

								}
							})
							//0xaa,  0x0c,    0x00,    0x10,
							//0x01, 0x01
							//报文头	 报文长度   帧序列号	帧数据	
							//设备id ，报文命令
							//0x0001	电机设置【电机类型】
							values = [0xaa, 0x14, 0x00, 0x10, 0x01, 0x05,
								0x40, 0x00, //三速使能 三速模式选择  
								/*
								0：三速功能关闭           1：拨动三速功能开启
								2：点动三速功能开启       3：加减三速功能开启
								4：拨动两速功能开启       5：点动两速功能开启
								6：加减两速功能开启
								*/

								0x42, 0x00, //低速限速比例(%)
								0x43, 0x00, //低速母线电流(A) * 0.1
								0x44, 0x00, //低速相线电流(A) * 0.1

								0x46, 0x00, //中速限速比例(%) 
								0x47, 0x00, //中速母线电流(A) * 0.1
								0x48, 0x00, //中速相线电流(A) * 0.1
							];
							console.log("三速功能发送数据971")
							this.handleWriteValue_w(values);
							//需要知道接下来的数据

								
						

							break;
						case 6: //Boost功能
						
							this.data = uni.getStorageSync('dev_data');
							uni.onBLECharacteristicValueChange((res) => {
								const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
								let splitResult = this.$util.ab2hext_str(value);
								console.log("Boost功能参数监听到的参数971", splitResult)
								if (splitResult[5] == "01") {
									//心跳？
									console.log("xintiao10");
								} else {



									let pro_address1 = this.$util.hebing_zijie(splitResult[6], splitResult[7])
									console.log("pro_address1", pro_address1)
									this.zd_js_data = pro_address1;
									pro_address1 = this.$util.get_bit(pro_address1, 6, 1)
									this.dq_sn = pro_address1 == 0 ? false : true;
									
									let zd_js = parseInt(splitResult[9] + splitResult[8], 16)
									// this.zd_js = zd_js == 0 ? false : true;
									console.log("zd_js", this.zd_js)
									
									this.sd_bl = parseInt(splitResult[11] + splitResult[10], 16)
									console.log("sd_bl", this.sd_bl)

									this.b_mx_a = parseInt(splitResult[13] + splitResult[12], 16) * 0.01
									console.log("b_mx_a", this.b_mx_a)

									this.b_xx_a = parseInt(splitResult[15] + splitResult[14], 16) * 0.1
									console.log("b_xx_a", this.b_xx_a)

									this.b_rc_a = parseInt(splitResult[17] + splitResult[16], 16) * 0.1
									console.log("b_rc_a", this.b_rc_a)

								}
							})
							//0xaa,  0x0c,    0x00,    0x10,
							//0x01, 0x01
							//报文头	 报文长度   帧序列号	帧数据	
							//设备id ，报文命令
							//0x0001	电机设置【电机类型】
							values = [0xaa, 16, 0x00, 0x10, 0x01, 0x05,

								0xa1, 0xf0, //氮气加速使能【打开的话 下边才能改】
								//自动加速	 返回的是4还是5
								/*
						  Bit0	巡航功能		
						  Bit1	自动巡航功能		
						  Bit2	巡航时三速使能		
						  Bit3	巡航临时提速功能		
						  Bit4	自动氮气加速功能(Boost)开关		
						  Bit5	氮气加速功能(Boost)开关		
					  */
								0x20, 0x02, //速度比例(%) 1 
								0x21, 0x02, //母线电流(A) 0.1
								0x22, 0x02, //相线电流(A) 0.1
								0x23, 0x02, //弱磁电流(A) 0.1
								// 0x00,0x10,//相线接线顺序
							];
							console.log("Boost功能发送数据")
							this.handleWriteValue_w(values);
							//需要知道接下来的数据
							break;
						case 7: //倒车功能
							this.data = uni.getStorageSync('dev_data');
							uni.onBLECharacteristicValueChange((res) => {
								const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
								let splitResult = this.$util.ab2hext_str(value);
								console.log("倒车功能参数监听到的参数971", splitResult)
								if (splitResult[5] == "01") {
									//心跳？
									console.log("xintiao11");
								} else {



									let pro_address1 = this.$util.hebing_zijie(splitResult[6], splitResult[7])
									console.log("pro_address1", pro_address1)
									this.dc_sn_data = pro_address1
									
									pro_address1 = this.$util.get_bit(pro_address1,5, 1)
									this.dc_sn = pro_address1 == 0 ? false : true;
									
									

									this.dc_sd_bl = parseInt(splitResult[9] + splitResult[8], 16)
									console.log("dc_sd_bl", this.dc_sd_bl)

									this.dc_min_bl = parseInt(splitResult[11] + splitResult[10], 16)
									console.log("dc_min_bl", this.dc_min_bl)

									this.dc_yc = parseInt(splitResult[13] + splitResult[12], 16)
									console.log("dc_yc", this.dc_yc)
								}
							})
							//0xaa,  0x0c,    0x00,    0x10,
							//0x01, 0x01
							//报文头	 报文长度   帧序列号	帧数据	
							//设备id ，报文命令
							//0x0001	电机设置【电机类型】
							values = [0xaa, 14, 0x00, 0x10, 0x01, 0x05,

								0x40, 0x00, //倒车使能   
								/*
								三速使能(两速时没有高速)	Bit0	0	6	0	2	1	"0：三速功能关闭           1：拨动三速功能开启
								2：点动三速功能开启       3：加减三速功能开启
								4：拨动两速功能开启       5：点动两速功能开启
								6：加减两速功能开启"
									Bit1						
									Bit2						
									Bit3						
								Sport档功能开关	Bit4	0	1	0	1	1	0：关闭； 1：使能
								倒车档功能开关	Bit5	0	1	0	1	1	0：关闭； 1：使能
								助力推行功能开关	Bit6	0	1	0	1	1	0：关闭； 1：使能
								*/
								// 0x30,0x00,//前进/倒退切换		777777
								0x55, 0x00, //速度比例(%)
								0x56, 0x00, //母线电流(A) * 0.1
								0x57, 0x00, //相线电流(A) * 0.1
								// 0x00,0x10,//相线接线顺序
							];
							console.log("倒车功能发送数据")
							this.handleWriteValue_w(values);
							//需要知道接下来的数据
							break;
						case 8: //巡航功能
							this.data = uni.getStorageSync('dev_data');
							
							uni.onBLECharacteristicValueChange((res) => {
								const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
								let splitResult = this.$util.ab2hext_str(value);
								console.log("巡航功能参数监听到的参数971", splitResult)
								if (splitResult[5] == "01") {
									//心跳？
									console.log("xintiao12");
								} else {
								
								
								
									let pro_address1 = this.$util.hebing_zijie(splitResult[6], splitResult[7])
									console.log("pro_address1", pro_address1)
									pro_address1 = this.$util.get_bit(pro_address1, 15, 1)
									this.xh_sn = pro_address1 == 0 ? false : true;
								
								// 	this.xf_type = parseInt(splitResult[9] + splitResult[8], 16)
								// 	console.log("xf_type", this.xf_type)
								
									this.xh_minsd_bl = parseInt(splitResult[9] + splitResult[8], 16)
									console.log("xh_minsd_bl", this.xh_minsd_bl)
								
									this.hx_yc_time = parseInt(splitResult[11] + splitResult[10], 16)
									console.log("hx_yc_time", this.hx_yc_time)
									
								}
								
							})
							//0xaa,  0x0c,    0x00,    0x10,
							//0x01, 0x01
							//报文头	 报文长度   帧序列号	帧数据	
							//设备id ，报文命令
							//0x0001	电机设置【电机类型】
							values = [0xaa, 12, 0x00, 0x10, 0x01, 0x05,

								0x01, 0x01, //巡航使能   777777
								/*
								  Bit0	巡航功能		  巡航方式
								  Bit1	自动巡航功能		
								  Bit2	巡航时三速使能		
								  Bit3	巡航临时提速功能		
								  Bit4	自动氮气加速功能(Boost)开关		
								  Bit5	氮气加速功能(Boost)开关		
								*/
								0x0b, 0x01, //最小速度比例(%)
								0x0c, 0x01, //延迟时间(ms) 
								// 0x00,0x10,//相线接线顺序
							];
							
							console.log("巡航功能发送数据")
							this.handleWriteValue_w(values);
							//需要知道接下来的数据
							break;
						case 9: //能量回收功能
							this.data = uni.getStorageSync('dev_data');
							uni.onBLECharacteristicValueChange((res) => {
								const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
								let splitResult = this.$util.ab2hext_str(value);
								console.log("能量回收功能参数监听到的参数971", splitResult)
								if (splitResult[5] == "01") {
									//心跳？
									console.log("xintiao14");
								} else {
								
									let pro_address1 = this.$util.hebing_zijie(splitResult[6], splitResult[7])
									console.log("pro_address1", pro_address1)
									pro_address1 = this.$util.get_bit(pro_address1, 15, 1)
									this.nl_sn = pro_address1 == 0 ? false : true;
								
								// 	this.xf_type = parseInt(splitResult[9] + splitResult[8], 16)
								// 	console.log("xf_type", this.xf_type)
								
									this.nl_minsd_bl = parseInt(splitResult[9] + splitResult[8], 16)
									console.log("nl_minsd_bl", this.nl_minsd_bl)
								
									this.nl_maxmx_a = parseInt(splitResult[11] + splitResult[10], 16) * 0.1
									console.log("nl_maxmx_a", this.nl_maxmx_a)
									
									this.nl_maxxx_a = parseInt(splitResult[13] + splitResult[12], 16) * 0.1
									console.log("nl_maxxx_a", this.nl_maxxx_a)
								}
							})
							//0xaa,  0x0c,    0x00,    0x10,
							//0x01, 0x01
							//报文头	 报文长度   帧序列号	帧数据	
							//设备id ，报文命令
							//0x0001	电机设置【电机类型】
							values = [0xaa, 14, 0x00, 0x10, 0x01, 0x05,
								0x00, 0x01, //能量回收使能    释放油门自动开启 Bit10 Bit11
								/*
									功能开关1	Bit0	蜂鸣器(0-关闭, 1-使能)		
								车辆功能		Bit1	P挡功能		
								车辆功能		Bit2	Audo Hold自动驻车(自动P档)		
								车辆功能		Bit3	边撑功能		
										Bit4	充电断电		
								车辆功能		Bit5	刹车断电功能		
										Bit6	电机温度检测		
										Bit7	CAN通信（0-关闭，1-使能）		
										Bit8	485/串口通信（0-关闭，1-使能）		
										Bit9	蓝牙通信（0-关闭，1-使能）		
								能量回收		Bit10	EBS功能		
								能量回收		Bit11	自动EBS功能		
										Bit12	HDC 陡坡缓降(0-关闭, 1-使能)		
										Bit13	TCS 牵引力控制(0-关闭, 1-使能)		
										Bit14	HHC 坡道保持功能(0-关闭, 1-使能)		
										Bit15			

								*/

								0x0d, 0x01, //最小回收速度比例(%)
								0x27, 0x00, //最大回收母线电流(A)  *0.1
								0x4f, 0x00, //最大回收相线电流(A)  * 0.1
								// 0x00,0x10,//相线接线顺序
							];
							console.log("能量回收功能发送数据")
							this.handleWriteValue_w(values);
							//需要知道接下来的数据
							break;
						case 10: //车辆功能

							this.data = uni.getStorageSync('dev_data');
							uni.onBLECharacteristicValueChange((res) => {
								const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
								let splitResult = this.$util.ab2hext_str(value);
								console.log("车辆功能参数监听到的参数971", splitResult)
								if (splitResult[5] == "01") {
									//心跳？
									console.log("xintiao15");
								} else {
								
									let pro_address1 = this.$util.hebing_zijie(splitResult[6], splitResult[7])
									console.log("pro_address1", pro_address1)
									pro_address1 = this.$util.get_bit(pro_address1, 15, 1)
									// this.nl_sn = pro_address1 == 0 ? false : true;
								
								// 	this.xf_type = parseInt(splitResult[9] + splitResult[8], 16)
								// 	console.log("xf_type", this.xf_type)
								
									this.cl_yc_time = parseInt(splitResult[9] + splitResult[8], 16)
									console.log("cl_yc_time", this.cl_yc_time)
								
									// this.nl_maxmx_a = parseInt(splitResult[11] + splitResult[10], 16)
									// console.log("nl_maxmx_a", this.nl_maxmx_a)
									
									// this.nl_maxxx_a = parseInt(splitResult[13] + splitResult[12], 16)
									// console.log("nl_maxxx_a", this.nl_maxxx_a)
								}
							})
							//0xaa,  0x0c,    0x00,    0x10,
							//0x01, 0x01
							//报文头	 报文长度   帧序列号	帧数据	
							//设备id ，报文命令
							//0x0001	电机设置【电机类型】
							values = [0xaa, 10, 0x00, 0x10, 0x01, 0x05,

								0x00, 0x01, //制动断电启用  Bit5
								/*
									功能开关1	Bit0	蜂鸣器(0-关闭, 1-使能)			1	1	0：关闭； 1：使能
								车辆功能		Bit1	P挡功能			1	1	0：关闭； 1：使能
								车辆功能		Bit2	Audo Hold自动驻车(自动P档)			1	1	0：关闭； 1：使能
								车辆功能		Bit3	边撑功能			1	1	0：关闭； 1：使能
										Bit4	充电断电			1	1	0：关闭； 1：使能
								车辆功能		Bit5	刹车断电功能			1	1	0：关闭； 1：使能
										Bit6	电机温度检测			1	1	0：关闭； 1：使能
										Bit7	CAN通信（0-关闭，1-使能）			1	1	0：关闭； 1：使能
										Bit8	485/串口通信（0-关闭，1-使能）			0	1	0：关闭； 1：使能
										Bit9	蓝牙通信（0-关闭，1-使能）			1	1	0：关闭； 1：使能
								能量回收		Bit10	EBS功能			1	1	0：关闭； 1：使能
								能量回收		Bit11	自动EBS功能			1	1	0：关闭； 1：使能
										Bit12	HDC 陡坡缓降(0-关闭, 1-使能)			1	1	0：关闭； 1：使能
										Bit13	TCS 牵引力控制(0-关闭, 1-使能)			0	1	0：关闭； 1：使能
										Bit14	HHC 坡道保持功能(0-关闭, 1-使能)			1	1	0：关闭； 1：使能
										Bit15						

								*/
								//侧边脚撑启用	Bit3
								//停车挡启用  Bit1
								0x0a, 0x01, //延迟时间(ms) 777777
								// 0x00,0x10,//相线接线顺序
							];
							console.log("车辆功能发送数据")
							this.handleWriteValue_w(values);
							//需要知道接下来的数据
							break;
					}

				}





				console.log(971, this.clone_index)
			},
			show_on() {

				app.globalData.is_rw = 1;
				if (uni.getStorageSync('user_type')) {
					this.user_type = uni.getStorageSync('user_type')
				}

				console.log(app.globalData.is_yuancheng, 7777777777)

				this.is_yuancheng = app.globalData.is_yuancheng;

				let lang = uni.getStorageSync('lang')

				this.lang = uni.getStorageSync('lang')

				if (this.lang == 1) {
					uni.setNavigationBarTitle({
						title: 'Parameter'
					})
				} else {
					uni.setNavigationBarTitle({
						title: '参数'
					})
				}




				// let is_ok = uni.getStorageSync('is_ok');
				// console.log(is_ok,777777777,'加载..')
				// if(is_ok != 1){

				// }else{

				// }



				this.is_biao = 0;

				this.deviceList = uni.getStorageSync('deviceList');
				this.serviceInfo = uni.getStorageSync('serviceInfo');
				this.writeCharacteristicsInfo = uni.getStorageSync('writeCharacteristicsInfo');


				this.notifyCharacteristicsInfo = uni.getStorageSync('notifyCharacteristicsInfo');
				this.deviceInfo = uni.getStorageSync('deviceInfo');


				var that = this;
				var devid = this.deviceInfo.deviceId; //decodeURIComponent(options.deviceId);
				var devname = this.deviceInfo.name; //decodeURIComponent(options.name);
				var devserviceid = this.serviceInfo.uuid; //decodeURIComponent(options.serviceId);


				app.globalData.is_rw = 1;
				if (uni.getStorageSync('user_type')) {
					this.user_type = uni.getStorageSync('user_type')
				}



				this.is_yuancheng = app.globalData.is_yuancheng;


				this.lang = uni.getStorageSync('lang')

				if (this.lang == 1) {
					uni.setNavigationBarTitle({
						title: 'settings 1'
					})
				} else {
					uni.setNavigationBarTitle({
						title: '设置一'
					})
				}




				// let is_ok = uni.getStorageSync('is_ok');
				// console.log(is_ok,777777777,'加载..')
				// if(is_ok != 1){

				// }else{
				this.data = uni.getStorageSync('dev_data');
				// }



				this.is_biao = 0;

				this.deviceList = uni.getStorageSync('deviceList');
				this.serviceInfo = uni.getStorageSync('serviceInfo');
				this.writeCharacteristicsInfo = uni.getStorageSync('writeCharacteristicsInfo');


				this.notifyCharacteristicsInfso = uni.getStorageSync('notifyCharacteristicsInfo');
				this.deviceInfo = uni.getStorageSync('deviceInfo');


				var that = this;
				var devid = this.deviceInfo.deviceId; //decodeURIComponent(options.deviceId);
				var devname = this.deviceInfo.name; //decodeURIComponent(options.name);
				var devserviceid = this.serviceInfo.uuid; //decodeURIComponent(options.serviceId);



			},
			biaoding() {
				if (app.globalData.connected != true) {
					return;
				}
				console.log("开始电流和电压");
				uni.onBLECharacteristicValueChange((res) => {
					const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
					utils.Rec_data_deal(value);
				})



				let that = this;
				let data = uni.getStorageSync('dev_data')
				var strArray = new Uint8Array([0xc9, 0x14, 0x02, 0x53, 0x48, 0x4F, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00,
					0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d
				]);

				var show_swicth_count = 0;
				if (app.globalData.connected == true) {


					var success_count = 0;
					var time_nub;
					var timeout_flag = false;

					if (app.globalData.success_count != success_count || timeout_flag == true) {


						success_count = app.globalData.success_count;
						clearTimeout(time_nub);
						timeout_flag = false;
						time_nub = setTimeout(function() {
							timeout_flag = true;
						}, 500);




						//远程控制和本地控制
						if (that.is_yuancheng == 0) {
							strArray[12] = 0x55;
						} else {
							//远程
							strArray[12] = 0xaa;
						}

						//转动把的值   上位机显示的值*100*32768/100/5.5
						let zbz = that.data.zbz * 100 * 32768 / 100 / 5.5;


						//13 上位机显示转把值高位  
						strArray[13] = (zbz >> 8);
						//14 上位机显示转把值低位  
						strArray[14] = (zbz & 0xff)

						if (show_swicth_count < 3) {
							show_swicth_count++;
							if (show_swicth_count == 1) {
								app.globalData.show_switch_bit = 0x10;
							} else {
								app.globalData.show_switch_bit = 0x08;
							}
						} else {
							show_swicth_count = 0;
							app.globalData.show_switch_bit = 0;
						}


						console.log("电流", that.data.vol_calibration_value);
						console.log("电压", that.data.cur_calibration_value);

						// console.log(data.flux_weak_calibration_value,that.data.flux_weak_calibration_value,444)
						strArray[15] = 0x00; //app.globalData.show_switch_bit;
						strArray[16] = 0x14; //that.data.flux_weak_calibration_value;
						strArray[17] = 0x55;
						strArray[18] = (that.data.vol_calibration_value >> 8);
						strArray[19] = (that.data.vol_calibration_value & 0xff);

						strArray[20] = (that.data.cur_calibration_value >> 8);
						strArray[21] = (that.data.cur_calibration_value & 0xff);
						let temp = strArray[0];
						for (let i = 1; i < strArray.length - 2; i++) {
							temp ^= strArray[i];
						}

						strArray[strArray.length - 2] = temp;
						if (app.globalData.connected == true) {


							console.log(that.deviceInfo.deviceId, 111);
							console.log(that.serviceInfo.uuid, 222);
							console.log(that.writeCharacteristicsInfo.uuid, 333);

							uni.writeBLECharacteristicValue({
								// 这里的 deviceId 需要在 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取
								deviceId: that.deviceInfo.deviceId,
								// 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
								serviceId: that.serviceInfo.uuid,
								// 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
								characteristicId: that.writeCharacteristicsInfo.uuid,
								// 这里的value是ArrayBuffer类型
								value: strArray.buffer,
								writeType: 'writeNoResponse',
								success(res) {
									console.log('开始第二次555555555555')
									setTimeout(function() {
										that.biaoding1();
									}, 1500)
								},
								fail(error) {
									console.log('fail555555555555')
									console.log(error)

									// uni.setStorageSync('deviceList', null);
									// uni.setStorageSync('deviceInfo', null);
									// app.globalData.connected = false;			  
									//  if (error.errCode) {
									// uni.showToast({ title: errorCode[error.errCode], icon: 'none' })
									//  } else if (error.errMsg) {
									// uni.showToast({ title: error.errMsg, icon: 'none' })
									//  } else {
									// uni.showToast({ title: 'fail', icon: 'none' })
									//  }	  
								},
							})
						}
					}


				}
			},
			biaoding1() {
				if (app.globalData.connected != true) {
					return;
				}
				console.log("开始电流和电压22222");
				uni.onBLECharacteristicValueChange((res) => {
					const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
					utils.Rec_data_deal(value);
				})


				var timeout_flag = true;
				let that = this;
				let data = uni.getStorageSync('dev_data')
				var strArray = new Uint8Array([0xc9, 0x14, 0x02, 0x53, 0x48, 0x4F, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00,
					0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d
				]);

				var show_swicth_count = 0;
				if (app.globalData.connected == true) {


					var success_count = 0;
					var time_nub;


					if (app.globalData.success_count != success_count || timeout_flag == true) {


						success_count = app.globalData.success_count;
						clearTimeout(time_nub);
						timeout_flag = false;
						time_nub = setTimeout(function() {
							timeout_flag = true;
						}, 500);




						//远程控制和本地控制
						if (that.is_yuancheng == 0) {
							strArray[12] = 0x55;
						} else {
							//远程
							strArray[12] = 0xaa;
						}

						//转动把的值   上位机显示的值*100*32768/100/5.5
						let zbz = that.data.zbz * 100 * 32768 / 100 / 5.5;


						//13 上位机显示转把值高位  
						strArray[13] = (zbz >> 8);
						//14 上位机显示转把值低位  
						strArray[14] = (zbz & 0xff)

						if (show_swicth_count < 3) {
							show_swicth_count++;
							if (show_swicth_count == 1) {
								app.globalData.show_switch_bit = 0x10;
							} else {
								app.globalData.show_switch_bit = 0x08;
							}
						} else {
							show_swicth_count = 0;
							app.globalData.show_switch_bit = 0;
						}


						console.log("电流", that.data.vol_calibration_value);
						console.log("电压", that.data.cur_calibration_value);

						// console.log(data.flux_weak_calibration_value,that.data.flux_weak_calibration_value,444)
						strArray[15] = 0; //app.globalData.show_switch_bit;
						strArray[16] = 0x14;
						strArray[17] = 0xaa;
						strArray[18] = (that.data.vol_calibration_value >> 8);
						strArray[19] = (that.data.vol_calibration_value & 0xff);

						strArray[20] = (that.data.cur_calibration_value >> 8);
						strArray[21] = (that.data.cur_calibration_value & 0xff);
						let temp = strArray[0];
						for (let i = 1; i < strArray.length - 2; i++) {
							temp ^= strArray[i];
						}

						strArray[strArray.length - 2] = temp;
						if (app.globalData.connected == true) {


							console.log(that.deviceInfo.deviceId, 111);
							console.log(that.serviceInfo.uuid, 222);
							console.log(that.writeCharacteristicsInfo.uuid, 333);

							uni.writeBLECharacteristicValue({
								// 这里的 deviceId 需要在 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取
								deviceId: that.deviceInfo.deviceId,
								// 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
								serviceId: that.serviceInfo.uuid,
								// 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
								characteristicId: that.writeCharacteristicsInfo.uuid,
								// 这里的value是ArrayBuffer类型
								value: strArray.buffer,
								writeType: 'writeNoResponse',
								success(res) {

									that.is_biao = 0;
									uni.setStorageSync('dev_data', that.data);
									uni.hideLoading();
									if (that.lang == 1) {
										uni.showToast({
											title: 'Successfully written parameters',
											icon: "none"
										})
									} else {
										uni.showToast({
											title: '写入参数成功',
											icon: "none"
										})
									}
								},
								fail(error) {
									// uni.hideLoading();
									console.log('fail555555555555')
									console.log(error)

									// uni.setStorageSync('deviceList', null);
									// uni.setStorageSync('deviceInfo', null);
									// app.globalData.connected = false;			  
									//  if (error.errCode) {
									// uni.showToast({ title: errorCode[error.errCode], icon: 'none' })
									//  } else if (error.errMsg) {
									// uni.showToast({ title: error.errMsg, icon: 'none' })
									//  } else {
									// uni.showToast({ title: 'fail', icon: 'none' })
									//  }	  
								},
							})
						}
					}


				}
			},
			likai() {
				if (this.is_yuancheng == 1) {
					this.is_biao = 1;
				}
			},
			ruoci() {

				if (this.data.flux_weak_calibration_value > 255) {
					this.data.flux_weak_calibration_value = 255;
				}
			},
			ssxl() {
				if (this.data.rise_ratio > 255) {
					this.data.rise_ratio = 255;
				}
				// if(this.data.rise_ratio < 0){
				// this.data.rise_ratio = 0;
				// }
				// data.sink_ratio
			},
			xjxl() {
				if (this.data.sink_ratio > 255) {
					this.data.sink_ratio = 255;
				}
				if (this.data.sink_ratio < 0) {
					this.data.sink_ratio = 0;
				}
				// data.sink_ratio
			},
			xh_openPicker(type) {
				this.$refs.xh_picker.open();
			},
			cj_openPicker(type) {
				this.$refs.cj_picker.open();
			},
			dy_openPicker(type) {
				this.$refs.dy_picker.open();
			},
			jb_openPicker(type) {
				this.$refs.jb_picker.open();
			},
			dy_confirm(e) {
				var index = e.indexs[0];
				this.data.voltage_level_index = index;
			},
			jb_confirm(e) {
				var index = e.indexs[0];
				this.data.softstart_level_index = index;
			},
			xh_confirm(e) {
				var index = e.indexs[0];
				console.log(index, "xh_confirm");
				this.data.pm_type_index = index;
			},
			cj_confirm(e) {
				var index = e.indexs[0];
				this.data.manufacturer_code_index = index;
			},

			switch_show_page: function() {
				let that = this;
				var strArray = new Uint8Array([0xc9, 0x14, 0x02, 0x53, 0x48, 0x4F, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00,
					0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d
				]);
				var show_swicth_count = 0;
				if (app.globalData.connected == true) {
					if (that.data.param_read_success_flag == true &&
						app.globalData.connected == true) {
						wx.navigateTo({
							url: '/pages/fork_showing/fork_showing?vol_calibration_value=' +
								encodeURIComponent(that.data.vol_calibration_value) +
								'&cur_calibration_value=' + encodeURIComponent(that.data
								.cur_calibration_value) +
								'&flux_weak_calibration_value=' + encodeURIComponent(that.data
									.flux_weak_calibration_value) +
								'&nub=' + encodeURIComponent(that.data.nub)
						});
						var success_count = 0;
						var time_nub;
						var timeout_flag = false;
						that.data.nub = setInterval(function() {
							if (app.globalData.success_count != success_count || timeout_flag == true) {
								success_count = app.globalData.success_count;
								clearTimeout(time_nub);
								timeout_flag = false;
								time_nub = setTimeout(function() {
									timeout_flag = true;
								}, 500);
								strArray[12] = 0xaa;
								if (show_swicth_count < 3) {
									show_swicth_count++;
									if (show_swicth_count == 1) {
										app.globalData.show_switch_bit = 0x10;
									} else {
										app.globalData.show_switch_bit = 0x08;
									}
								} else {
									show_swicth_count = 0;
									app.globalData.show_switch_bit = 0;
								}

								strArray[15] = app.globalData.show_switch_bit;
								strArray[16] = that.data.flux_weak_calibration_value;
								strArray[18] = (that.data.vol_calibration_value >> 8);
								strArray[19] = (that.data.vol_calibration_value & 0xff);
								strArray[20] = (that.data.cur_calibration_value >> 8);
								strArray[21] = (that.data.cur_calibration_value & 0xff);
								let temp = strArray[0];
								for (let i = 1; i < strArray.length - 2; i++) {
									temp ^= strArray[i];
								}
								strArray[strArray.length - 2] = temp;
								if (app.globalData.connected == true) {
									that.writeBLECharacteristicValue(strArray.buffer);
								}
							}
						}, 200);
					} else {
						/* wx.showModal({
						   title: "先连接控制器",
						   showCancel: false,
						   confirmText: "确定"
						 })*/
					}
				}
			},
			writeBLECharacteristicValue(buffer) {


				uni.writeBLECharacteristicValue({
					// 这里的 deviceId 需要在 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取
					deviceId: this.deviceInfo.deviceId,
					// 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
					serviceId: this.serviceInfo.uuid,
					// 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取

					characteristicId: this.writeCharacteristicsInfo.uuid,
					// 这里的value是ArrayBuffer类型
					value: buffer,
					writeType: 'writeNoResponse',
					success(res) {
						console.log('writeBLECharacteristicValue success', res.errMsg)

					},
					fail(error) {
						console.log('fail')
						console.log(error)


					},
				})
			},
			_param_write: function() {



				if (app.globalData.connected != true) {
					uni.showToast({
						title: '需要先连接蓝牙',
						icon: "none"
					})
					return;
				}


				let is_ok = uni.getStorageSync('is_ok');
				console.log(is_ok, 777777777, '写入1')
				if (is_ok == 0) {
					if (this.lang == 0) {
						uni.showToast({
							title: '需要先提交二维码给客服',
							icon: 'none',
							duration: 1000
						})
					} else {
						uni.showToast({
							title: 'You need to submit the QRcode to customer service first',
							icon: 'none',
							duration: 1000
						})
					}
					return;
				}
				if (this.lang == 1) {
					uni.showLoading({
						title: 'Parameter writing',
						mask: true
					})
				} else {

					uni.showLoading({
						title: '参数写入中....',
						mask: true,
					});
				}


				app.globalData.ble_write_enable = true
				let that = this;
				let temp;
				let strArray = new Uint8Array(24);
				let define_date_length = 24;
				if (app.globalData.ble_write_enable == true) {
					// uni.showToast({
					//   title: '参数写入中....',
					//   icon: 'none',
					//   mask: true
					// })









					app.globalData.write_param_success_flag = false;
					that.get_page0_information();

					temp = that.data.page0_tx_message[0];
					for (let i = 1; i < define_date_length - 2; i++) {
						temp ^= that.data.page0_tx_message[i];
					}
					that.data.page0_tx_message[define_date_length - 2] = temp;
					//that.writeBLECharacteristicValue(that.data.page0_tx_message.buffer);
					for (let i = 0; i < define_date_length; i++) {
						strArray[i] = that.data.page0_tx_message[i];
					}
					console.log(strArray)
					that.writeBLECharacteristicValue(strArray.buffer);

					setTimeout(function() {
						that.get_page1_information();
						temp = that.data.page1_tx_message[0];
						for (let i = 1; i < define_date_length - 2; i++) {
							temp ^= that.data.page1_tx_message[i];
						}
						that.data.page1_tx_message[define_date_length - 2] = temp;
						//that.writeBLECharacteristicValue(that.data.page1_tx_message.buffer);
						for (let i = 0; i < define_date_length; i++) {
							strArray[i] = that.data.page1_tx_message[i];
						}
						that.writeBLECharacteristicValue(strArray.buffer);

						setTimeout(function() {
							that.get_page2_information();
							temp = that.data.page2_tx_message[0];
							for (let i = 1; i < define_date_length - 2; i++) {
								temp ^= that.data.page2_tx_message[i];
							}
							that.data.page2_tx_message[define_date_length - 2] = temp;
							//that.writeBLECharacteristicValue(that.data.page2_tx_message.buffer);
							for (let i = 0; i < define_date_length; i++) {
								strArray[i] = that.data.page2_tx_message[i];
							}
							that.writeBLECharacteristicValue(strArray.buffer);

							setTimeout(function() {
								that.get_page3_information();
								temp = that.data.page3_tx_message[0];
								for (let i = 1; i < define_date_length - 2; i++) {
									temp ^= that.data.page3_tx_message[i];
								}
								that.data.page3_tx_message[define_date_length - 2] = temp;
								//that.writeBLECharacteristicValue(that.data.page3_tx_message.buffer);
								for (let i = 0; i < define_date_length; i++) {
									strArray[i] = that.data.page3_tx_message[i];
								}
								that.writeBLECharacteristicValue(strArray.buffer);

								setTimeout(function() {
									that.get_page4_information();
									temp = that.data.page4_tx_message[0];
									for (let i = 1; i < define_date_length - 2; i++) {
										temp ^= that.data.page4_tx_message[i];
									}
									that.data.page4_tx_message[define_date_length -
										2] = temp;
									//that.writeBLECharacteristicValue(that.data.page4_tx_message.buffer);
									for (let i = 0; i < define_date_length; i++) {
										strArray[i] = that.data.page4_tx_message[i];
									}
									that.writeBLECharacteristicValue(strArray.buffer);

									setTimeout(function() {
										that.get_page5_information();
										temp = that.data.page5_tx_message[0];
										for (let i = 1; i <
											define_date_length - 2; i++) {
											temp ^= that.data.page5_tx_message[
												i];
										}
										that.data.page5_tx_message[
											define_date_length - 2] = temp;
										//that.writeBLECharacteristicValue(that.data.page5_tx_message.buffer);
										for (let i = 0; i <
											define_date_length; i++) {
											strArray[i] = that.data
												.page5_tx_message[i];
										}
										that.writeBLECharacteristicValue(
											strArray.buffer);

										setTimeout(function() {
											that
										.get_page6_information();
											temp = that.data
												.page6_tx_message[0];
											for (let i = 1; i <
												define_date_length -
												2; i++) {
												temp ^= that.data
													.page6_tx_message[
														i];
											}
											that.data.page6_tx_message[
												define_date_length -
												2] = temp;
											//that.writeBLECharacteristicValue(that.data.page6_tx_message.buffer);
											for (let i = 0; i <
												define_date_length; i++
												) {
												strArray[i] = that.data
													.page6_tx_message[
														i];
											}
											that.writeBLECharacteristicValue(
												strArray.buffer);


											// if (app.globalData.write_param_success_flag == true) {
											//   uni.vibrateLong();

											console.log(that.is_biao,
												"第一个读取1111111111")
											// if(that.is_biao == 1){
											// 	that.biaoding();
											// }else{



											setTimeout(function() {
												uni
											.hideLoading();
												if (that
													.lang == 1
													) {
													uni.showModal({
														title: 'Parameter writing',
														cancelText: "cancel", // 取消按钮的文字
														confirmText: "ok", // 确认按钮的文字  
														success: (
															res
															) => {}
													})
												} else {
													uni.showModal({
														title: '参数写入成功',
														success: (
															res
															) => {}
													})
												}

											}, 100)

											// }

											// } else {
											//   uni.showModal({
											//     title: "写入参数失败",
											//     showCancel: false,
											//     confirmText: "确定"
											//   })
											// }

										}, 100);
									}, 100);
								}, 100);
							}, 100);
						}, 100);
					}, 100);
				} else {
					uni.showToast({
						title: '无权限'
					})
				}
			},
			param_write() {
				console.log(this.is_biao, 7777777);

				if (app.globalData.connected == true) {
					let that = this;
					// if (that.data.param_read_success_flag == true) {


					that._param_write();


					// } else {
					//   uni.showModal({
					// 	title: "请先连接新连接控制器，或导入配置",
					// 	showCancel: false,
					// 	confirmText: "确定"
					//   })
					// }
				} else {
					uni.showModal({
						title: "请先连接",
						showCancel: false,
						confirmText: "确定"
					})

				}
			},
			ass(ass) {
				return "点动";
			},
			change(e) {
				this.huadong1 = e;
				console.log(e, 7777777)
			},
			change1(e) {
				this.huadong2 = e;
				console.log(e, 7777777)
			},
			goSearch() {
				uni.navigateTo({
					url: '../search/search'
				})
			},
			goList() {
				uni.navigateTo({
					url: '../goodsList/goodsList'
				})
			},

			// 初始化蓝牙模块
			handleInitBluetooth(callback) {
				console.log('测试')
				var that = this;
				// 初始化蓝牙模块
				uni.openBluetoothAdapter({
					success(result) {
						console.log('success')
						// {errno: 0, errMsg: "openBluetoothAdapter:ok"}
						console.log(result)
						// uni.showToast({ title: '正常' })
						this.isInitBluetooth = true
						if (callback) {
							callback()
						}
					},
					fail(error) {
						setTimeout(function() {
							console.log(11)
							that.handleSearchDevices();
						}, 1000);

						// console.log('fail')
						console.log(error)
						// if (error.errCode) {
						//   uni.showToast({ title: errorCode[error.errCode], icon: 'none' })
						// } else if (error.errMsg) {
						//   uni.showToast({ title: error.errMsg, icon: 'none' })
						// } else {
						//   uni.showToast({ title: 'fail', icon: 'none' })
						// }
					},
				})
			},
			// 开始搜寻附近的蓝牙外围设备。此操作比较耗费系统资源，请在搜索并连接到设备后调用 uni.stopBluetoothDevicesDiscovery 方法停止搜索。
			handleSearchDevices() {
				const startBluetoothDevicesDiscovery = () => {
					uni.startBluetoothDevicesDiscovery({
						// services: ['FEE7'],
						success(res) {
							console.log(res)
						},
						fail(error) {
							console.log('fail')
							console.log(error)
							if (error.errCode) {
								uni.showToast({
									title: errorCode[error.errCode],
									icon: 'none'
								})
							} else if (error.errMsg) {
								uni.showToast({
									title: error.errMsg,
									icon: 'none'
								})
							} else {
								uni.showToast({
									title: 'fail',
									icon: 'none'
								})
							}
						},
					})
				}
				if (this.isInitBluetooth) {
					startBluetoothDevicesDiscovery()
				} else {
					this.handleInitBluetooth(startBluetoothDevicesDiscovery)
				}
			},
			// 停止搜寻附近的蓝牙外围设备。若已经找到需要的蓝牙设备并不需要继续搜索时，建议调用该接口停止蓝牙搜索。
			handleWriteValues() {
				if (app.globalData.connected != true) {
					if (this.lang == 0) {
						uni.showToast({
							title: '需要先连接蓝牙',
							icon: "none"
						})
					} else {
						uni.showToast({
							title: 'Bluetooth needs to be connected first',
							icon: "none"
						})
					}
					return;
				}

				let is_ok = uni.getStorageSync('is_ok');
				console.log(is_ok, 777777777, '写入2')
				if (is_ok == 0) {
					if (this.lang == 0) {
						uni.showToast({
							title: '需要先提交二维码给客服',
							icon: 'none',
							duration: 1000
						})
					} else {
						uni.showToast({
							title: 'You need to submit the QRcode to customer service first',
							icon: 'none',
							duration: 1000
						})
					}
					return;
				}


				uni.showLoading({
					title: 'loading',
					mask: true
				});


				this.handleWriteValue();


			},
			handleWriteValue_w(values) {
				let that = this;
				//AA 0C 00 10 01 1F 00 00 00 00 00 00 DB 79 

				//0xdb, 0x79,
				// 0 - 255
				let temp = this.$util.CRC16Modbus(values);


				console.log("发送数据", temp)
				console.log("发送数据", this.$util.ab2hext_str(temp))

				let strArray = new Uint8Array(temp)

				const buffer = strArray.buffer

				// const buffer = new ArrayBuffer(1)
				// const dataView = new DataView(buffer)
				// dataView.setUint8(0, 0)

				// 向低功耗蓝牙设备特征值中写入二进制数据
				uni.writeBLECharacteristicValue({
					// 这里的 deviceId 需要在 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取
					deviceId: this.deviceInfo.deviceId,
					// 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
					serviceId: this.serviceInfo.uuid,
					// 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
					characteristicId: this.writeCharacteristicsInfo.uuid,
					// 这里的value是ArrayBuffer类型
					value: buffer,
					writeType: 'writeNoResponse',
					success(res) {
						console.log("发送成功")
						console.log('writeBLECharacteristicValue success', res.errMsg)

					},
					fail(error) {
						uni.hideLoading();
						console.log('fail')
						console.log(error)

						if (error.errCode) {
							uni.showToast({
								title: errorCode[error.errCode],
								icon: 'none'
							})
						} else if (error.errMsg) {
							uni.showToast({
								title: error.errMsg,
								icon: 'none'
							})
						} else {
							uni.showToast({
								title: 'fail',
								icon: 'none'
							})
						}

					},
				})
			},
			// 向低功耗蓝牙设备特征值中写入二进制数据
			handleWriteValue() {

				if (app.globalData.connected != true) {
					if (this.lang == 0) {
						uni.showToast({
							title: '需要先连接蓝牙',
							icon: "none"
						})
					} else {
						uni.showToast({
							title: 'Bluetooth needs to be connected first',
							icon: "none"
						})
					}
					return;
				}

				let is_ok = uni.getStorageSync('is_ok');
				console.log(is_ok, 777777777, '写入')
				if (is_ok == 0) {
					if (this.lang == 0) {
						uni.showToast({
							title: '需要先提交二维码给客服',
							icon: 'none',
							duration: 1000
						})
					} else {
						uni.showToast({
							title: 'You need to submit the QRcode to customer service first',
							icon: 'none',
							duration: 1000
						})
					}
					return;
				}




				uni.onBLECharacteristicValueChange((res) => {
					console.log('监听低功耗蓝牙设备的特征值变化1111', res)
					// console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`)
					// console.log(ab2hex(res.value))

					const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
					console.log(value, 9999999)
					this.funReadPage(value)
					// this.Rec_data_deal(value);
				})


				let strArray = new Uint8Array([
					0xc9, 0x14, 0x02, 0x4c, 0x44, 0x47, 0x45, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
					0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d,
				])
				let temp = strArray[0]
				for (let i = 1; i < strArray.length - 2; i++) {
					temp ^= strArray[i]
				}
				strArray[strArray.length - 2] = temp
				const buffer = strArray.buffer

				// const buffer = new ArrayBuffer(1)
				// const dataView = new DataView(buffer)
				// dataView.setUint8(0, 0)



				// 向低功耗蓝牙设备特征值中写入二进制数据
				uni.writeBLECharacteristicValue({
					// 这里的 deviceId 需要在 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取
					deviceId: this.deviceInfo.deviceId,
					// 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
					serviceId: this.serviceInfo.uuid,
					// 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
					characteristicId: this.writeCharacteristicsInfo.uuid,
					// 这里的value是ArrayBuffer类型
					value: buffer,
					writeType: 'writeNoResponse',
					success(res) {
						console.log('writeBLECharacteristicValue success', res.errMsg)
						//写入如成功？




					},
					fail(error) {
						console.log('fail')
						console.log(error)

						if (error.errCode) {
							uni.showToast({
								title: errorCode[error.errCode],
								icon: 'none'
							})
						} else if (error.errMsg) {
							uni.showToast({
								title: error.errMsg,
								icon: 'none'
							})
						} else {
							uni.showToast({
								title: 'fail',
								icon: 'none'
							})
						}

					},
				})
			},
			//获取蓝牙设备某个服务中的所有 characteristic（特征值）
			getBLEDeviceCharacteristics() {
				var that = this;
				uni.getBLEDeviceCharacteristics({
					deviceId: this.deviceInfo.deviceId,
					serviceId: this.serviceInfo.uuid,
					success: function(res) {

						for (let i = 0; i < res.characteristics.length; i++) {
							let item = res.characteristics[i]
							if (item.properties.read) { //该特征值是否支持 read 操作

							}
							if (item.properties.write) { //该特征值是否支持 write 操作


							}
							if (item.properties.notify || item.properties
								.indicate) { //该特征值是否支持 notify或indicate 操作

								that.notifyBLECharacteristicValueChange();
							}
						}
					}
				})
			},
			//设置监听
			notifyBLECharacteristicValueChange() {
				var that = this;
				uni.notifyBLECharacteristicValueChange({
					type: "notification",
					state: true, // 启用 notify 功能
					deviceId: this.deviceInfo.deviceId,
					serviceId: this.serviceInfo.uuid,
					characteristicId: this.notifyCharacteristicsInfo.uuid,
					success: function(res) {

						that.onBLECharacteristicValueChange(); //监听特征值变化

					},
					fail: function(res) {
						// uni.showToast({
						//   title: 'notify启动失败',
						//   mask: true
						// });
						// setTimeout(function () {
						//   uni.hideToast();
						// }, 2000)
					}
				})
			},
			//业务监听
			onBLECharacteristicValueChange() {
				uni.onBLECharacteristicValueChange((res) => {
					console.log('监听低功耗蓝牙设备的特征值变化', res)
					// console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`)
					// console.log(ab2hex(res.value))

					const value = Array.prototype.map.call(new Uint8Array(res.value), (bit) => bit)
					console.log(value)
					this.funReadPage(value)
				})
			}


		},
	}
</script>


<style lang="scss" scoped>
	page {
		background: #19253E;
	}

	.setting1 {
		min-height: 100vh;

		.rights {
			float: right;
			width: 10px;
			height: 17px;
			margin-top: 15px;
			margin-left: 15px;

		}

		background: #19253E;
		width: 100%;
		float: left;

		.left {
			float: left;
			color: #fff;
		}

		.right {
			float: right;
			color: #fff;
		}

		// padding-bottom: 100rpx;

		.nav_top {
			width: 94%;
			margin-left: 3%;
			heigth: 30px;
			color: #979FAE;
			background: #111823;
		}

		.nav_menus {
			background: rgba(255, 255, 255, 0.2);
			;
			margin-top: 7px;
			width: 94%;
			margin-left: 3%;
			color: #C0C2C4;
			border-radius: 0.3em;

			.titie_top {
				font-size: 32rpx;
				background: #475165;
				height: 100rpx;
				line-height: 100rpx;
				border-radius: 0.3em;

				.top_left {
					color: #fff;
					margin-left: 3%;

					.le_img {
						width: 56rpx;
						height: 56rpx;
						float: left;
						margin-top: 22rpx;
					}

					view {
						float: left;
						margin-left: 10rpx;
					}
				}

				.top_right {
					margin-right: 3%;

					image {
						margin-top: 36rpx;
						;
						width: 32rpx;
						height: 32rpx;

					}
				}
			}

			.titie_body_line {
				background: rgba(255, 255, 255, 0.2);
				margin-left: 6%;
				width: 88%;
				height: 1rpx;
			}

			.titie_body {

				background: #475165;
				height: 50px;
				line-height: 50px;
				margin-left: 3%;
				width: 94%;
				font-size: 28rpx;

				.titie_body_left {

					float: left;

				}

				.titie_body_right {
					position: relative;
					top: -50rpx;
					float: right;

					view {
						color: #fff;
						height: 44rpx;
						line-height: 44rpx;
						width: 240rpx;
						text-align: center;
						margin-top: 10rpx;
					}

					.right {
						margin-top: 10rpx;
						color: #fff;
						height: 64rpx;
						line-height: 64rpx;
						width: 240rpx;
						text-align: center;
						background: rgba(255, 255, 255, 0.2);
						border-radius: 4px 4px 4px 4px;
					}
				}

				.body_line {
					margin-left: 3%;
					width: 94%;

					.left {
						color: #fff;
						float: left;

						input {
							width: 140px;
							background: rgba(255, 255, 255, 0.2);
							height: 30px;
							line-height: 30px;
							text-align: center;
							margin-top: 10px;
							margin-right: 3%;
							;
							color: #fff;
							border-radius: 8rpx;
						}

						.ts {
							height: 35px;
						}

						.ts1 {
							height: 30px;
						}
					}

					.right {
						height: 40px;
						float: right;

						input {
							width: 140px;
							background: #545b67;
							height: 30px;
							line-height: 30px;
							text-align: center;
							margin-top: 10px;
							margin-right: 3%;
							;
							color: #fff;
							border-radius: 0.2em;
						}

						.rig_img {
							width: 8px;
							height: 13px;
							border-radius: 0px 0px 0px 0px;
							opacity: 1;
							position: relative;
							left: 245rpx;
							top: -22px;
						}

						.check {
							margin-top: 35rpx;
							;
						}

						.evan-switch {
							margin-top: 11px;
						}

						.uv-radio {
							margin-top: 8px;
						}

						.huadong {
							width: 130px;
							margin-top: 18px;
							margin-right: 20px;

							.fonts {
								color: #507afe;
								font-size: 14px;
								float: right;
								width: 15px;
								text-align: center;
								position: relative;
								top: -33px;
								right: -20px;
							}
						}

						.ts {
							height: 35px;
						}

						.ts1 {
							height: 30px;
						}
					}
				}

			}

			.titie_body1 {
				height: 90px;
			}
		}

		.childers {
			margin-top: 35rpx;
		}

		.bomt {
			margin-top: 20rpx;
			float: left;
			z-index: 9;
			width: 94%;
			margin-left: 3%;
			// position: fixed;
			// padding-top: 20rpx;


			height: 70rpx;
			line-height: 70rpx;
			margin-bottom: 40rpx;

			font-size: 32rpx;


			text-align: center;
			height: 80rpx;
			line-height: 80rpx;
			border-radius: 10rpx;
			background: #507afe;
			color: #fff;

		}

		.bottom {
			float: left;
			width: 94%;
			margin-left: 2.5%;
			height: 80rpx;
			line-height: 80rpx;
			border-radius: 5px 5px 5px 5px;
			opacity: 1;
			border: 1px solid #4F7AFD;
			text-align: center;
			font-size: 22rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 600;
			margin-top: 40rpx;
			margin-bottom: 60rpx;
			color: #4F7AFD;
		}
	}
</style>